Hi, here is the exact configuration I'm using now.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<param name="pattern" value="%-4relative [%thread] %-5level %class - %msg%n" />
</layout>
</appender>
<appender name="bitranlog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<param name="File" value="bitran.log" />
<rollingPolicy class="ch.qos.logback.core.rolling.SizeBasedRollingPolicy">
<param name="MaxFileSize" value="5MB" />
</rollingPolicy>
<layout
class="ch.qos.logback.classic.PatternLayout">
<param name="pattern" value="%-4relative [%thread] %-5level %class - %msg%n" />
</layout>
</appender>
<logger name="org.accma.concentrator.services.bitran.BiTranService">
<level value="debug"/>
<appender-ref ref="bitranlog"/>
</logger>
<root>
<level value="debug" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
~
Sebastien Pennec <sebastien@qos.ch>
wrote:
Hello Samuel,
Thanks for trying logback!
The RollingFileAppender needs a TriggeringPolicy object to know when to roll the
active output file.
In brief, a TriggeringPolicy controls the conditions under which roll-over occurs.
Such conditions include time of day, file size, an external event, the log request or
a combination thereof.
A working configuration file for a RollingFileAppender would be:
With this configuration, the file would be rolled each time it reaches 5MB.
When I look at the configuration file that you sent, something seems strange to me:
Why do you configure two Loggers with the same Appender and one of them with the
Additivity flag set to false? One would obtain the same result simply by attaching
the RollingFileAppender to the root logger.
Hope this helps you get on track with logback. Do not hesitate to write again if you
run into trouble.
Sébastien
--
Sébastien Pennec
sebastien@qos.ch
Logback: The reliable, generic, fast and flexible logging framework for Java.
Samuel Doyle a écrit :
> Hello,
>
> I'm new to logback but read your documentation, I an not receiving any
> output to my logfile. Here is my configuration file, following this is
> the output from logback to the console. The only thing I notice is a
> warning about a TriggerPolicy. If this is the case do you have example
> syntax?
> ---
>
>
>
>
>
>
> class="ch.qos.logback.core.rolling.RollingFileAppender">
>
>
>
>
>
>
>
>
>
>
> additivity="false">
>
>
>
>
>
>
>
>
>
>
>
> ---
> Here is console output when using LoggerStatusPrinter:
> ---
>
> startElement [configuration]
> startElement [appender]
> startElement [param]
> startElement [param]
> LOGBACK: No context given for ch.qos.logback.core.util.PropertySetter@8c5ea2
> startElement [param]
> startElement [param]
> LOGBACK: No context given for
> ch.qos.logback.core.util.PropertySetter@198defc
> startElement [layout]
> startElement [param]
> startElement [logger]
> startElement [level]
> startElement [appender-ref]
> startElement [root]
> startElement [level]
> startElement [appender-ref]
> INFO in ch.qos.logback.classic.joran.action.ConfigurationAction -
> Ignoring debug attribute.
> INFO in ch.qos.logback.core.joran.action.AppenderAction - About to
> instantiate appender of type [ch
> .qos.logback.core.rolling.RollingFileAppender]
> INFO in ch.qos.logback.core.joran.action.AppenderAction - Appender named
> as [bitranlog]
> WARN in ch.qos.logback.core.rolling.RollingFileAppender[bitranlog] -
> Please set a TriggeringPolicy
> for the RollingFileAppender named bitranlog
> INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping
> appender named [bitranlog] from t
> he object stack
> INFO in ch.qos.logback.classic.joran.action.LevelAction -
> org.accma.concentrator.services.bitran.Bi
> TranService level set to DEBUG
> INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching
> appender named [bitranlog to
> Logger[org.accma.concentrator.services.bitran.BiTranService]
> INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set
> to DEBUG
> INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching
> appender named [bitranlog to
> Logger[root]
>
>
> Thanks, S.D.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Logback-user mailing list
> Logback-user@qos.ch
> http://qos.ch/mailman/listinfo/logback-user
_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://qos.ch/mailman/listinfo/logback-user