Hi

We have different appenders, one file appender and one syslog appender
amongst others. We want the file appender to use a normal Logger and the
syslog appender using an AsyncLogger. When the different
applications/functions perform the logging they don't know if it will end
up in the file appender only or in both the file appender and syslog
appender. The syslog appender have a filter (AlertFilter) that decides if
the log event will be accepted or not. The file appender has no filter.

The configuration looks like below (important parts included, some
attributes masked):

Any suggestion on how to be able to use the same logger name (which
obviously is not allowed) or achieve something that works the same way?

Best regards, preciate any help
LF

<Configuration status="debug" packages="xyz">
  <Appenders>
    <Console name="ConsoleLogAppender" target="SYSTEM_OUT">
      <PatternLayout pattern="%m"/>
    </Console>
    <Syslog name="AlertLogAppender" host="xyz" port="xyz" protocol="TCP"
format="RFC5424" facility="LOCAL6"
        includeMDC="false" enterpriseNumber="xyz" appName="xyz"
newLine="true" messageId="Alert" id="App">
      <AlertFilter onMatch="ACCEPT" onMismatch="DENY"/>
    </Syslog>
    <RollingFile name="RollingFileAppender" fileName="logs/application.log"
        filePattern="logs/application.log.%i.gz" immediateFlush="true"  >
      <PatternLayout pattern =%m%n"/>
      <Policies>
        <OnStartupTriggeringPolicy/>
        <SizeBasedTriggeringPolicy size="10 MB"/>
      </Policies>
      <DefaultRolloverStrategy max="2"/>
    </RollingFile>
  </Appenders>
  <Loggers>
    <AsyncLogger name="foo" level="info" additivity="false">
      <AppenderRef ref="AlertLogAppender"/>
    </AsyncLogger>
    <Logger name="foo" level="info" additivity="false">
      <AppenderRef ref="RollingFileAppender"/>
    </Logger>
    <Root level="warn">
      <AppenderRef ref="ConsoleLogAppender"/>
    </Root>
  </Loggers>
</Configuration>

-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsme...@gmail.com, and destroy all copies of this
message and any attachments.

Reply via email to