Happy to have downloaded the alpha sources using wget (wget is nifty worked
on windows too : wget -e robots=off --cut-dirs=3 -r -p -np
--no-check-certificate
https://repository.apache.org/content/repositories/orgapachelogging-009/org/apache/logging/log4j/)
and making my first test project with log4j2 !

Upgraded the conf to write to a rolling file.

*Ralph : *Where can we learn about using the rolling file manager? can a
class subscribe to roll events so we can do custom tasks for old files
(like pack them up in to a password protected zip and store in an alternate
location, when the number of files is more than 300 ? The listener would
count the number of files etc but the log4j rolling manager should take
care of 'missing files' as we would delete them after archiving). if it
does not have support for this could you add it?

The conf I used :

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
  <appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} -
%msg%n"/>
    </Console>

    <RollingFile name="Rolling-1" fileName="logs/a.log"
                           filePattern="logs/test1-${sd:type}.%i.log.gz">
                <PatternLayout>
                  <pattern>%d %p %C [%t] %m%n</pattern> <!-- %d %p %C{1.}
[%t] %m%n -->
                </PatternLayout>
                <SizeBasedTriggeringPolicy size="500" />
<!-- want to hook a class here to listen to rolling events after they occur
-->
     </RollingFile>

  </appenders>
  <loggers>
    <root level="debug">
      <appender-ref ref="Console"/>
      <appender-ref ref="Rolling-1"/>
    </root>
  </loggers>
</configuration>

*Users : *For anyone interested - here is the source of the eclipse project
http://sel2in.com/pages/log4j/ , with config xml and java files. All it
needs are the log4j jars that you can get from
http://logging.apache.org/log4j/2.x/ if the site does not open try after an
hour ... :) might be down for temporary maintenance.

Regards
Tushar Kapila

Reply via email to