2010년 02월 01일
JDeveloper Embedded OC4J 기동시 오류
작성자 : 김민석 ( lemonfish at gmail dot com )
오라클 WAS 개발을 위해 어쩔수 없이 JDeveloper 를 사용하게 됐다.
Process exited with exit code 128.

# by | 2010/02/01 15:49 | 삽질 | 트랙백 | 덧글(0)
lemonfish.egloos.com (타칭 개발자의 블로그 입니다.)Egloos | Log-in
Process exited with exit code 128.

# by | 2010/02/01 15:49 | 삽질 | 트랙백 | 덧글(0)
Common.Logging 상에서 구현체로 log4net 을 사용할 경우 두 라이브러리 사이의 인터페이싱을 위해서 Log4NetLoggerFactoryAdapter 라는 클래스가 사용된다. Log4NetLoggerFactoryAdapter 는 Web.config 에서 configType 과 configFile 만을 인자로 입력 받는다.
<!-- 2. 로깅 섹션 -->
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="FILE-WATCH"/>
<!-- 로깅 설정을 다르게 하고자 할경우 아래 경로에 해당 설정파일을 지정 -->
<arg key="configFile" value="~/Config/Common/Log4Net.xml"/>
</factoryAdapter>
</logging>
</common>
configFile 부분이 log4net 설정 파일의 위치가 되겠다. 그런데 여기서 value 에 해당하는 부분은 가상디렉토리 경로를 지원하지 않는다.
왜그렇지? 하고 Log4NetLoggerFactoryAdapter 의 소스를 뜯어보면
configFile = string.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory.TrimEnd('/', '\\'), configFile.Substring(2));이렇게 되있다. 무조건 웹애플리케이션의 루트디렉토리를 기본으로 하도록 되어있으니 가상디렉토리 경로가 먹힐리 만무.
<!-- 2. 로깅 섹션 -->
<common>
<logging>
<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
<arg key="configType" value="FILE-WATCH"/>
<!-- 로깅 설정을 다르게 하고자 할경우 아래 경로에 해당 설정파일을 지정 -->
<arg key="configFile" value="~/Config/Common/Log4Net.xml"/>
<!-- 설정파일이 가상디렉터리에 있을 경우 아래의 옵션을 준다. -->
<arg key="virtualPath" value="true"/>
</factoryAdapter>
</logging>
</common>
virtualPath 라는 인자를 통해 configFile 의 value 값이 가상디렉토리의 경로인지 알려주도록 하고 Log4NetLoggerFactoryAdapter 의 configFile 처리 부분을 아래와 같이 수정했다.
위에서 빨간 부분이 수정된 부분이다. virtualPath 라는 인자에 true 값이 있을 경우 Server.MapPath 를 통해서 가상디렉토리를 제대로 처리한다.protected Log4NetLoggerFactoryAdapter(NameValueCollection properties, ILog4NetRuntime runtime)
: base(true)
{
if (runtime == null)
{
throw new ArgumentNullException("runtime");
}
_runtime = runtime;// parse config properties
string configType = ArgUtils.GetValue(properties, "configType", string.Empty).ToUpper();
string configFile = ArgUtils.GetValue(properties, "configFile", string.Empty);string virtualPath = ArgUtils.GetValue(properties, "virtualPath", "false");
if (bool.Parse(virtualPath))
{
configFile = HttpContext.Current.Server.MapPath(configFile);
}
// app-relative path?
else if (configFile.StartsWith("~/") || configFile.StartsWith("~\\"))
{
configFile = string.Format("{0}/{1}", AppDomain.CurrentDomain.BaseDirectory.TrimEnd('/', '\\'), configFile.Substring(2));
}if (configType == "FILE" || configType == "FILE-WATCH")
{
if (configFile == string.Empty)
{
throw new ConfigurationException("Configuration property 'configFile' must be set for log4Net configuration of type 'FILE' or 'FILE-WATCH'.");
}if (!File.Exists(configFile))
{
throw new ConfigurationException("log4net configuration file '" + configFile + "' does not exists");
}
}switch (configType)
{
case "INLINE":
_runtime.XmlConfiguratorConfigure();
break;
case "FILE":
_runtime.XmlConfiguratorConfigure(configFile);
break;
case "FILE-WATCH":
_runtime.XmlConfiguratorConfigureAndWatch(configFile);
break;
case "EXTERNAL":
// Log4net will be configured outside of Common.Logging
break;
default:
_runtime.BasicConfiguratorConfigure();
break;
}
}
# by | 2009/11/25 16:19 | 삽질 | 트랙백 | 덧글(0)
◀ 이전 페이지 다음 페이지 ▶