[
https://issues.apache.org/jira/browse/LOG4J2-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Remko Popma updated LOG4J2-1427:
--------------------------------
Description:
I use slf4j api with async log4j2-implementation, the files created from
appender used in <Root> logger not getting compressed ,although if i used the
appender on a normal logger it works fine and compress the file ex:
{code}
<logger name=xyz>
<Appender-Ref ref="APPENDER"/>
</logger>
{code}
Note: we are using spring framework , hibernate and camel ,and those components
do logging as well
this is my configuration :::
{code}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF" name="LOG" packages="com.x.y.log">
<Properties>
<Property name="LOGGING_PATH">Logs</Property>
<!-- <Property name="MAX_HISTORY">30</Property> -->
<Property name="PATTERN">%date{HH:mm:ss.SSS} |
%5level|%-10.-10thread|[%logger{53}:%4line] : %msg %ex{full} %n</Property>
</Properties>
<Appenders>
<Routing name="FILE">
<Routes pattern="FILE">
<Route>
<!--
*******
the file created from the following appender is not compressed, it's only
rolled over and creates a new file and the original file keeps increasing
included in <asyncRoot>
*******
-->
<RollingFile name="FILE"
fileName="${LOGGING_PATH}/FILE/FILE.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/FILE/ARCHEIVE/FILE.%d{yyyy-MM-dd}-%i.log.zip">
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Routing name="SQL">
<Routes pattern="SQL">
<Route>
<!--
WORKS FINE
NOT included in <asyncRoot>
-->
<RollingFile name="SQL"
fileName="${LOGGING_PATH}/SQL/SQL.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/SQL/ARCHEIVE/SQL.%d{yyyy-MM-dd}-%i.log.zip">
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Routing name="CamelIntegration">
<Routes pattern="CamelIntegration">
<Route>
<!--
NOT WORKING
included in <asyncRoot>
-->
<RollingFile name="CamelIntegration"
fileName="${LOGGING_PATH}/CamelIntegration/CamelIntegration.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/CamelIntegration/ARCHEIVE/CamelIntegration.%d{yyyy-MM-dd}-%i.log.zip">
<IsCamelFilter onMatch="ACCEPT"
/>
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>${PATTERN}</Pattern>
</PatternLayout>
</Console>
</Appenders>
<Loggers>
<asyncLogger name="jdbc.sqlonly" level="INFO"
additivity="false">
<appender-ref ref="SQL" />
</asyncLogger>
<asyncRoot level="DEBUG" includeLocation="true" additivity="false">
<AppenderRef ref="CamelIntegration" />
<AppenderRef ref="STDOUT" />
<AppenderRef ref="FILE" />
</asyncRoot>
</Loggers>
</Configuration>
{code}
was:
I use slf4j api with async log4j2-implementation, the files created from
appender used in <Root> logger not getting compressed ,although if i used the
appender on a normal logger it works fine and compress the file ex:
<logger name=xyz>
<Appender-Ref ref="APPENDER"/>
</logger>
Note: we are using spring framework , hibernate and camel ,and those components
do logging as well
this is my configuration :::
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF" name="LOG" packages="com.x.y.log">
<Properties>
<Property name="LOGGING_PATH">Logs</Property>
<!-- <Property name="MAX_HISTORY">30</Property> -->
<Property name="PATTERN">%date{HH:mm:ss.SSS} |
%5level|%-10.-10thread|[%logger{53}:%4line] : %msg %ex{full} %n</Property>
</Properties>
<Appenders>
<Routing name="FILE">
<Routes pattern="FILE">
<Route>
<!--
*******
the file created from the following appender is not compressed, it's only
rolled over and creates a new file and the original file keeps increasing
included in <asyncRoot>
*******
-->
<RollingFile name="FILE"
fileName="${LOGGING_PATH}/FILE/FILE.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/FILE/ARCHEIVE/FILE.%d{yyyy-MM-dd}-%i.log.zip">
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Routing name="SQL">
<Routes pattern="SQL">
<Route>
<!--
WORKS FINE
NOT included in <asyncRoot>
-->
<RollingFile name="SQL"
fileName="${LOGGING_PATH}/SQL/SQL.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/SQL/ARCHEIVE/SQL.%d{yyyy-MM-dd}-%i.log.zip">
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Routing name="CamelIntegration">
<Routes pattern="CamelIntegration">
<Route>
<!--
NOT WORKING
included in <asyncRoot>
-->
<RollingFile name="CamelIntegration"
fileName="${LOGGING_PATH}/CamelIntegration/CamelIntegration.${date:yyyy-MM-dd}.log"
filePattern="${LOGGING_PATH}/CamelIntegration/ARCHEIVE/CamelIntegration.%d{yyyy-MM-dd}-%i.log.zip">
<IsCamelFilter onMatch="ACCEPT"
/>
<PatternLayout
Pattern="${PATTERN}">
</PatternLayout>
<Policies>
<SizeBasedTriggeringPolicy size="2 MB" />
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy />
</RollingFile>
</Route>
</Routes>
</Routing>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout>
<Pattern>${PATTERN}</Pattern>
</PatternLayout>
</Console>
</Appenders>
<Loggers>
<asyncLogger name="jdbc.sqlonly" level="INFO"
additivity="false">
<appender-ref ref="SQL" />
</asyncLogger>
<asyncRoot level="DEBUG" includeLocation="true" additivity="false">
<AppenderRef ref="CamelIntegration" />
<AppenderRef ref="STDOUT" />
<AppenderRef ref="FILE" />
</asyncRoot>
</Loggers>
</Configuration>
Which version of Log4j2 are you using?
> zipping files not working when file is created from appender used in root
> logger.
> ---------------------------------------------------------------------------------
>
> Key: LOG4J2-1427
> URL: https://issues.apache.org/jira/browse/LOG4J2-1427
> Project: Log4j 2
> Issue Type: Bug
> Reporter: Killua
> Priority: Blocker
>
> I use slf4j api with async log4j2-implementation, the files created from
> appender used in <Root> logger not getting compressed ,although if i used the
> appender on a normal logger it works fine and compress the file ex:
> {code}
> <logger name=xyz>
> <Appender-Ref ref="APPENDER"/>
> </logger>
> {code}
> Note: we are using spring framework , hibernate and camel ,and those
> components do logging as well
> this is my configuration :::
> {code}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="OFF" name="LOG" packages="com.x.y.log">
> <Properties>
> <Property name="LOGGING_PATH">Logs</Property>
> <!-- <Property name="MAX_HISTORY">30</Property> -->
> <Property name="PATTERN">%date{HH:mm:ss.SSS} |
> %5level|%-10.-10thread|[%logger{53}:%4line] : %msg %ex{full} %n</Property>
> </Properties>
> <Appenders>
> <Routing name="FILE">
> <Routes pattern="FILE">
> <Route>
> <!--
> *******
> the file created from the following appender is not compressed, it's only
> rolled over and creates a new file and the original file keeps increasing
> included in <asyncRoot>
> *******
> -->
>
> <RollingFile name="FILE"
>
> fileName="${LOGGING_PATH}/FILE/FILE.${date:yyyy-MM-dd}.log"
>
> filePattern="${LOGGING_PATH}/FILE/ARCHEIVE/FILE.%d{yyyy-MM-dd}-%i.log.zip">
> <PatternLayout
> Pattern="${PATTERN}">
> </PatternLayout>
> <Policies>
>
> <SizeBasedTriggeringPolicy size="2 MB" />
>
> <TimeBasedTriggeringPolicy />
> </Policies>
> <DefaultRolloverStrategy />
> </RollingFile>
> </Route>
> </Routes>
> </Routing>
> <Routing name="SQL">
> <Routes pattern="SQL">
> <Route>
> <!--
>
> WORKS FINE
> NOT included in <asyncRoot>
> -->
> <RollingFile name="SQL"
>
> fileName="${LOGGING_PATH}/SQL/SQL.${date:yyyy-MM-dd}.log"
>
> filePattern="${LOGGING_PATH}/SQL/ARCHEIVE/SQL.%d{yyyy-MM-dd}-%i.log.zip">
> <PatternLayout
> Pattern="${PATTERN}">
> </PatternLayout>
> <Policies>
>
> <SizeBasedTriggeringPolicy size="2 MB" />
>
> <TimeBasedTriggeringPolicy />
> </Policies>
> <DefaultRolloverStrategy />
> </RollingFile>
> </Route>
> </Routes>
> </Routing>
>
> <Routing name="CamelIntegration">
> <Routes pattern="CamelIntegration">
> <Route>
>
> <!--
> NOT WORKING
> included in <asyncRoot>
> -->
>
> <RollingFile name="CamelIntegration"
>
> fileName="${LOGGING_PATH}/CamelIntegration/CamelIntegration.${date:yyyy-MM-dd}.log"
>
> filePattern="${LOGGING_PATH}/CamelIntegration/ARCHEIVE/CamelIntegration.%d{yyyy-MM-dd}-%i.log.zip">
> <IsCamelFilter onMatch="ACCEPT"
> />
> <PatternLayout
> Pattern="${PATTERN}">
> </PatternLayout>
> <Policies>
>
> <SizeBasedTriggeringPolicy size="2 MB" />
>
> <TimeBasedTriggeringPolicy />
> </Policies>
> <DefaultRolloverStrategy />
> </RollingFile>
> </Route>
> </Routes>
> </Routing>
> <Console name="STDOUT" target="SYSTEM_OUT">
> <PatternLayout>
> <Pattern>${PATTERN}</Pattern>
> </PatternLayout>
> </Console>
> </Appenders>
>
> <Loggers>
> <asyncLogger name="jdbc.sqlonly" level="INFO"
> additivity="false">
> <appender-ref ref="SQL" />
> </asyncLogger>
> <asyncRoot level="DEBUG" includeLocation="true" additivity="false">
> <AppenderRef ref="CamelIntegration" />
> <AppenderRef ref="STDOUT" />
> <AppenderRef ref="FILE" />
> </asyncRoot>
> </Loggers>
> </Configuration>
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]