You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "dzlee (JIRA)" <ji...@apache.org> on 2019/06/27 08:46:00 UTC
[jira] [Updated] (LOG4J2-2645) windows system RollingFile name not
full path,cause RollingFile not work.
[ https://issues.apache.org/jira/browse/LOG4J2-2645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
dzlee updated LOG4J2-2645:
--------------------------
Description:
i upadate web project log framework from log4j to log4j2(2.11.2).
system is windows10.
i add a log4j2.xml
{code:java}
<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>
{code}
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 .
was:
i upadate web project log framework from log4j to log4j2(2.11.2).
system is windows10.
i add a log4j2.xml
{code:java}
<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>
{code}
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 .
> windows system RollingFile name not full path,cause RollingFile not work.
> -------------------------------------------------------------------------
>
> Key: LOG4J2-2645
> URL: https://issues.apache.org/jira/browse/LOG4J2-2645
> Project: Log4j 2
> Issue Type: Bug
> Components: Appenders, Configurators
> Affects Versions: 2.11.2
> Environment: windows10,idea,tomcat8,JDK8,spring framework4.3.3
> Reporter: dzlee
> Priority: Minor
> Labels: Policy, RollingFile, appenders
>
> i upadate web project log framework from log4j to log4j2(2.11.2).
> system is windows10.
> i add a log4j2.xml
>
> {code:java}
> <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>
> {code}
>
> 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 .
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)