Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2645

windows system RollingFile name not full path,cause RollingFile not work.

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.11.2
    • None
    • Appenders, Configurators
    • windows10,idea,tomcat8,JDK8,spring framework4.3.3

    Description

      i upadate web project log framework from log4j to log4j2(2.11.2).

      system is windows10.

      i add a log4j2.xml

       

      <Properties>
          <!-- below is the wrong path ,not a full path in winows,it's for linux -->
          <property name="basePath">/opt/maxtech/tomcat_logs/newhrlogs</property>
          <!-- below is the right path-->
          <!--<property name="basePath">D:\opt\maxtech\tomcat_logs\log4j2</property>-->
          <property name="loggz">loggz</property>
          <property name="rolling_fileName">${basePath}/hhrapp.log</property>
      </Properties>
      <appenders>
      
      
      <RollingFile name="error_log" fileName="${rolling_fileName}"
                   filePattern="${basePath}/${loggz}/hrapp-%d{yyyy-MM-dd-HH-mm-ss}.log">
          <PatternLayout pattern="${log_pattern}"/>
          <DefaultRolloverStrategy max="30"/>
          <Filters>
              <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
          </Filters>
          <Policies>
      
              <SizeBasedTriggeringPolicy size="20 MB"/>
              <!--                <CronTriggeringPolicy schedule="0 0 0 * * ? *"/>-->
              <TimeBasedTriggeringPolicy interval="11" modulate="true"/>
          </Policies>
      
      </RollingFile>
      
      
      

       
      with wrong basepath=/opt/maxtech/tomcat_logs/newhrlogs

      log4j2 after tomcat start,create log file in tomcat disk partition.

      ex:my tomcat path=d:\...\tomcat log file path  will be D:\opt\maxtech\tomcat_logs\log4j2.

      start tomcat ceate log file is  just fine.But the Policies will not work anymore.

      unless i change the basepath to a fullpath in windows,

      like: d:\opt\maxtech\tomcat_logs\log4j2 

      or ${sys:catalina.base}/somepath/log4j2

       

      After tomcat start Log4j2 can create file(with not full path),why could't create file use Policies configuration and no error msg .

       

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            GreyDesolate dzlee

            Dates

              Created:
              Updated:

              Slack

                Issue deployment