2016-12-02 8 views
0

log4j 2.5로 업그레이드 한 후에도 응용 프로그램이 log4j 1.2를 가리 킵니다. 아래에서 log4j2.xml 파일 및 경고를 찾아서 서버를 시작합니다. 아래의 구성에 따라 로그 파일을 생성해야하지만 생성하지는 않습니다.응용 프로그램이 가리키는 가리 키지 않는 2.x 1.2

참고 : 블로우 구성은 로컬 시스템에서 작동하지만 서버에 배포 할 때는 작동하지 않습니다.

<?xml version="1.0" encoding="UTF-8" ?> 
    <Configuration status="TRACE"> 
     <Properties> 
      <Property name="rotateLogsInterval">6</Property> 
      <Property name="log.dir">D:\\Mconnect\\LOGGER</Property> 
      <Property name="log.INVALIDMNO.dir">D:\\Mconnect\\LOGGER\\INVALIDMNO</Property> 
      <Property name="log.MOBINL1000.dir">D:\\Mconnect\\LOGGER\\MOBINL1000</Property> 

      <Property name="log.ECONET1000.dir">D:\\Mconnect\\LOGGER\\ECONET1000</Property> 
      <Property name="log.AIRTEL1000.dir">D:\\Mconnect\\LOGGER\\AIRTEL1000</Property> 
     </Properties> 

     <Appenders> 
      <Console name="Console" target="SYSTEM_OUT"> 
       <PatternLayout pattern="%-5p %d [%t] %c: %m%n" /> 
      </Console> 

      <File name="EIGInformation" 
       fileName="C:\\EIG_SOURCE_CODE\\EIG_20140901\\logs\\EIGInformation1.log"> 
       <PatternLayout> 
        <Pattern>%5p | %m%n</Pattern> 
       </PatternLayout> 
      </File> 

      <!-- Debug logger --> 
      <RollingRandomAccessFile name="debugLogger" 
       fileName="${log.dir}/mconnectDebugLogger.log" 
       filePattern="${log.dir}/$${date:yyyy-MM}/mconnectDebugLogger-%d{yyyy-MM-dd-HH}-%i.log.gz"> 

       <PatternLayout> 
        <Pattern>%5p | %d | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.dir}" maxDepth="2"> 
        <IfFileName glob="*/mconnectDebugLogger-*.log.gz" /> <IfLastModified age="60d" 
        /> </Delete> </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 
      <!-- Transaction tdr file --> 
      <RollingRandomAccessFile name="transactionDetails" 
       fileName="${log.dir}/TDR.log" 
       filePattern="${log.dir}/$${date:yyyy-MM}/TDR-%d{yyyy-MM-dd-HH}-%i.log.gz"> 

       <PatternLayout> 
        <Pattern>%5p | %d | %t:: | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.dir}" maxDepth="2"> 
        <IfFileName glob="*/TDR-*.log.gz" /> <IfLastModified age="60d" /> </Delete> 
        </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 

      <!-- Connect Info General log. --> 
      <RollingRandomAccessFile name="connectInfoLogGeneral" 
       fileName="${log.INVALIDMNO.dir}/connectInfoLogGeneral.log" 
       filePattern="${log.INVALIDMNO.dir}/$${date:yyyy-MM}/connectInfoLogGeneral-%d{yyyy-MM-dd-HH}-%i.log.gz"> 

       <PatternLayout> 
        <Pattern>%5p | %d | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.INVALIDMNO.dir}" 
        maxDepth="2"> <IfFileName glob="*/connectInfoLogGeneral-*.log.gz" /> <IfLastModified 
        age="60d" /> </Delete> </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 

      <!-- Connect Process log. --> 
      <RollingRandomAccessFile name="connectProcessLogGeneral" 
       fileName="${log.INVALIDMNO.dir}/connectProcessLogGeneral.log" 
       filePattern="${log.INVALIDMNO.dir}/$${date:yyyy-MM}/connectProcessLogGeneral-%d{yyyy-MM-dd-HH}-%i.log.gz"> 
       <PatternLayout> 
        <Pattern>%5p | %d | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.log.INVALIDMNO.dir.dir}" 
        maxDepth="2"> <IfFileName glob="*/connectProcessLogGeneral-*.log.gz" /> <IfLastModified 
        age="60d" /> </Delete> </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 

      <!-- Connect Info log --> 
      <RollingRandomAccessFile name="connectInfoLogMOBINL1000" 
       fileName="${log.MOBINL1000.dir}/connectInfoMOBINL1000.log" 
       filePattern="${log.MOBINL1000.dir}/$${date:yyyy-MM}/connectInfoMOBINL1000-%d{yyyy-MM-dd-HH}-%i.log.gz"> 

       <PatternLayout> 
        <Pattern>%5p | %d | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.MOBINL1000.dir}" 
        maxDepth="2"> <IfFileName glob="*/connectInfoMOBINL1000-*.log.gz" /> <IfLastModified 
        age="60d" /> </Delete> </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 

      <!-- Connect Process log --> 
      <RollingRandomAccessFile name="connectProcessLogMOBINL1000" 
       fileName="${log.MOBINL1000.dir}/connectProcessMOBINL1000.log" 
       filePattern="${log.MOBINL1000.dir}/$${date:yyyy-MM}/connectProcessMOBINL1000-%d{yyyy-MM-dd-HH}-%i.log.gz"> 

       <PatternLayout> 
        <Pattern>%5p | %d | %m%n</Pattern> 
       </PatternLayout> 
       <!-- <DefaultRolloverStrategy> <Delete basePath="${log.MOBINL1000.dir}" 
        maxDepth="2"> <IfFileName glob="*/connectProcessMOBINL1000-*.log.gz" /> <IfLastModified 
        age="60d" /> </Delete> </DefaultRolloverStrategy> --> 
       <Policies> 
        <TimeBasedTriggeringPolicy interval="${rotateLogsInterval}" /> 
       </Policies> 
      </RollingRandomAccessFile> 


     </Appenders> 

     <Loggers> 

      <!-- CXF is used heavily by Mule for web services --> 
      <AsyncLogger name="org.apache.cxf" level="WARN" /> 

      <!-- Apache Commons tend to make a lot of noise which can clutter the log --> 
      <AsyncLogger name="org.apache" level="INFO" /> 

      <!-- Reduce startup noise --> 
      <AsyncLogger name="org.springframework.beans.factory" 
       level="WARN" /> 

      <!-- Mule classes --> 
      <AsyncLogger name="org.mule" level="INFO" /> 
      <AsyncLogger name="com.mulesoft" level="INFO" /> 


      <AsyncLogger name="EIGInformation" level="INFO"> 
       <AppenderRef ref="EIGInformation" /> 
      </AsyncLogger> 

      <AsyncLogger 
       name="com.comviva.mconnect.webservices.impl.MConnectWebServices" 
       level="info"> 
       <AppenderRef ref="debugLogger" /> 
      </AsyncLogger> 
      <AsyncLogger name="transactionDetails" level="OFF"> 
       <AppenderRef ref="debugLogger" /> 
      </AsyncLogger> 

      <AsyncLogger name="connectInfoLogGeneral" level="INFO"> 
       <AppenderRef ref="connectInfoLogGeneral" /> 
      </AsyncLogger> 
      <AsyncLogger name="connectProcessLogGeneral" level="INFO"> 
       <AppenderRef ref="connectProcessLogGeneral" /> 
      </AsyncLogger> 

      <AsyncLogger name="connectInfoLogMOBINL1000" level="INFO"> 
       <AppenderRef ref="connectInfoLogMOBINL1000" /> 
      </AsyncLogger> 
      <AsyncLogger name="connectProcessLogMOBINL1000" level="INFO"> 
       <AppenderRef ref="connectProcessLogMOBINL1000" /> 
      </AsyncLogger> 

      <AsyncRoot level="INFO"> 
       <AppenderRef ref="EIGInformation" /> 
      </AsyncRoot> 
     </Loggers> 

    </Configuration> 



log4j: Using URL [file:/home/contest/prd/muleTomcat/webapps/Connect-1.3.0/WEB-INF/classes/log4j2.xml] for automatic log4j configuration. 
log4j: Preferred configurator class: org.apache.log4j.xml.DOMConfigurator 
log4j: System property is :null 
log4j: Standard DocumentBuilderFactory search succeded. 
log4j: DocumentBuilderFactory is: org.apache.xerces.jaxp.DocumentBuilderFactoryImpl 

log4j:WARN Continuable parsing error 2 and column 31 
log4j:WARN Document root element "Configuration", must match DOCTYPE root "null". 
log4j:WARN Document root element "Configuration", must match DOCTYPE root "null". 
log4j:WARN Continuable parsing error 2 and column 31 
log4j:WARN Document is invalid: no grammar found.log4j:WARN Document is invalid: no grammar found. 

log4j:ERROR DOM element is - not a <log4j:configuration> element. 
log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog). 
log4j:WARN Please initialize the log4j system properly. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 
[localhost-startStop-1] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence 

답변

1

문제는 이전 log4j-1.2.x.jar이 여전히 클래스 경로에 있다는 것입니다. 클래스 경로에서 제거하고 다음 항아리가 클래스 경로에 있는지 확인하십시오 :

  1. 의 log4j-API-2.x.jar
  2. 의 log4j-코어 2.x.jar
  3. 의 log4j-1.2 ~ api-2.x.jar -이 어댑터는 응용 프로그램이 Log4j2 구현에 대한 로깅 호출을 라우팅합니다.

2.x 용 Log4j 최신 버전 (이 글을 쓰는 시점에서는 2.7)을 사용하는 것이 좋습니다.

slf4j를 사용하는 경우 org.slf4j:slf4j-log4j12 (이전 Log4j 1 용)을 제거하고 org.apache.logging.log4j:slf4j-impl을 추가하십시오.

+0

답장을 보내 주셔서 감사합니다. 방금 언급 한 jar 파일을 클래스 경로에 추가했는데 1.2 항이 제거되었지만 아직 행운이 없습니다. 게시물에서 언급 한 것과 같은 오류가 발생합니다. 나는 slf4j-api-1.7.7과 slf4j-simple-1.7.7을 사용하고 있으며 slf4j-log4j12를 사용하지 않습니다. – damodaram

+0

''log4j : ... ''로그는 Log4j 1에 의해 만들어 지므로, 1.2 jar 파일은 어딘가의 클래스 패스에 있어야합니다 ... 또한'log4j-1.2-api-2.x.jar'는 classpath에 있거나 Log4j 1.2 jar 뒤에옵니다. 확인을 위해'System.getProperty ("java.class.path")'를 출력 할 수 있습니다. –