riemann/riemann

Override logging config from logback.xml (or similar logback config)

Closed this issue · 0 comments

heaje commented

I have been playing around with attempting to override the logging in Riemann 0.2.12 using a logback.xml file. Unfortunately, I have not been able to do so. I can get a small bit of debug logging into a different log file (looks like a few ancillary libraries used by Riemann), but I have been unable to force Riemann to do all it's logging based on config found in logback.xml.

For instance, I've attempted to use this logback.xml:

 
  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>/var/log/riemann/testFile.log</file>
    <append>true</append>
    <!-- set immediateFlush to false for much higher logging throughput -->
    <immediateFlush>true</immediateFlush>
    <!-- encoders are assigned the type
                  ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
    <encoder>
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
    </encoder>
  </appender>
 
  <root level="DEBUG">
    <appender-ref ref="FILE" />
  </root>
</configuration>

I then referenced that config by dropping "-Dlogback.configurationFile=file:/etc/riemann/logback.xml" into the command line when I run Riemann.

After doing those steps, I got this output in /var/log/riemann/testFile.log:

2796 [main] DEBUG c.amazonaws.AmazonWebServiceClient - Internal logging succesfully configured to commons logger: true
2803 [main] DEBUG com.amazonaws.metrics.AwsSdkMetrics - Admin mbean registered under com.amazonaws.management:type=AwsSdkMetrics
2948 [main] DEBUG c.a.internal.config.InternalConfig - Configuration override awssdk_config_override.json not found.
5609 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework
5622 [main] DEBUG i.n.u.internal.PlatformDependent0 - java.nio.Buffer.address: available
5623 [main] DEBUG i.n.u.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
5623 [main] DEBUG i.n.u.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
5624 [main] DEBUG i.n.u.internal.PlatformDependent0 - java.nio.Bits.unaligned: true
5624 [main] DEBUG i.n.u.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): available
5625 [main] DEBUG io.netty.util.internal.Cleaner0 - java.nio.ByteBuffer.cleaner(): available
5625 [main] DEBUG i.n.util.internal.PlatformDependent - Java version: 8
5625 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noUnsafe: false
5625 [main] DEBUG i.n.util.internal.PlatformDependent - sun.misc.Unsafe: available
5626 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noJavassist: false
5626 [main] DEBUG i.n.util.internal.PlatformDependent - Javassist: unavailable
5626 [main] DEBUG i.n.util.internal.PlatformDependent - You don't have Javassist in your class path or you don't have enough permission to load dynamically generated classes.  Please check the configuration for better performance.
5627 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
5627 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
5627 [main] DEBUG i.n.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
5627 [main] DEBUG i.n.util.internal.PlatformDependent - io.netty.maxDirectMemory: 883949568 bytes

No other logging occurred in /var/log/riemann/testFile.log.

If this isn't currently possible, it'd be a great feature for a future release. While Riemann does provide some capability for defining logging, it's not nearly as flexible as a logback.xml file.