Hi all,

Searching in documentation i didn't find (or wrong search) an example to separate log files based on its level.

The idea is to have separate files named based on its level, so all error messages will be redirected to "somefile-error.log", info to "somefile-info.log", and so on... with relative additivity property.

I suppose to use a <Routing> tag, but...how to iterate over message level (which lookup should i use)?

My example:

<Configuration status="fatal">
        <Routing name="Routing">
            <Routes pattern="$${some_message_level_variable}">
<RollingFile name="RollingFile-${some_message_level_variable}" fileName="the/path/logs/somefile-${some_message_level_variable}.log" filePattern="the/path/logs/somefile-${some_message_level_variable}-%d{yyyy-MM-dd}-%i.log.gz">
                            <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
                            <TimeBasedTriggeringPolicy />


        <Console name="STDOUT" target="SYSTEM_OUT">
                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
        <Root level="warn">
            <AppenderRef ref="Routing"/>
            <AppenderRef ref="STDOUT"/>

Ideas on which property lookup should i use instead of ${some_message_level_variable}??

A note: the best would be to not set any variable in ThreadContext and/or *Map map......

Thanks for your patience,

Best regards,


Reply via email to