Output to system.log stops at 12:00 a.m. each day - cassandra

Running: Cassandra 2.1.8.689 | DSE 4.7.3 on Linux 2.6
Configured logback.xml. Cassandra stops writing to log file at midnight each day. Last entry in log file:
INFO [CompactionExecutor:6550] 2017-01-05 23:59:58,928INFO ...
After changing filename in logback.xml (ie. system1.log to system2.log), writing resumes. The same behavior is consistent across 6 nodes.
Thank you Aaron. Logback details below.
<configuration scan="true">
<appender name="FIX_WINDOW_BASED_FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${cassandra.logdir}/system.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${cassandra.logdir}/system%i.log</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>31</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>200MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%-5level [%thread] %date{ISO8601} %marker %F:%L - %msg%n</pattern>
<!-- old-style log format
<pattern>%5level [%thread] %date{ISO8601} %F (line %L) %msg%n</pattern>
-->
</encoder>
Problem resolved. After upgrading DSE from 4.7.3 to 4.8.11, output to the system.log is working fine.

You should be able to control this behavior in your logback.xml file. In that file should be an <appender> section, which should look something like this:
<appender name="stash" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
</filter>
<file>/var/log/cassandra/system.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>/var/log/cassandra/system.log.%d{yyyy-MM-dd}-%i</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 50MB -->
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 5 days' worth of history -->
<maxHistory>5</maxHistory>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
My guess is that the file rollover is triggered at midnight, but there must be something in your <fileNamePattern> preventing it from creating a new file.

Related

How to change puppetserver loglevel for ELK

I have a puppet server 5.3 which logs to logstash.
Daily I get ~90k messages, 95% of which are with log level INFO.
I would like to get only the WARN and ERROR level but regardless what I try, I still get the INFOs.
This is how I send the data to logstash via logback.xml:
<!-- This is the logstash part -->
<appender name="stash" class="net.logstash.logback.appender.LogstashSocketAppender">
<host>logserverhostname.com</host>
<port>514</port>
<level>WARN</level>
</appender>
<!-- End of the logstash part -->
<root level="WARN">
<appender-ref ref="stash" />
</root>
This is what I get when I check Kibana:
message:{"#timestamp":"2019-03-26T12:54:13.493+01:00","#version":1,"message":"Puppet 'replace_facts' command for somehost.com submitted to PuppetDB with UUID 92ba53a7-83f2-4438-b1da-f39cd7ccc844","logger_name":"puppetserver","thread_name":"qtp1518931796-63","level":"INFO","level_value":20000,"HOSTNAME":"puppet-server.com"} severity_label:Emergency severity:0 tags:syslog, _grokparsefailure_sysloginput #timestamp:March 26th 2019, 12:54:13.492 priority:0 #version:1 facility_label:kernel host:IP.IP.IP.IP facility:0 _id:v6PZuWkBButu0N-H0QkS _type:doc _index:syslog-2019.03.26 _score: -
I can filter out the result in Kibana, but I would prefer that I do not feed it with useless messages, thus saving IO, network traffic and disk space.

Slow Query Logger Cassandra on server side in Cassandra 3.11.4

As per
https://issues.apache.org/jira/browse/CASSANDRA-12403
I tried to enable slow query logging with below steps on Cassandra 3.11.4 ,
but not able to query them any idea what is the issue, or am i missing any step .
`/nodetool getlogginglevels
Logger Name Log Level
ROOT INFO
com.thinkaurelius.thrift ERROR
org.apache.cassandra DEBUG
org.apache.cassandra.db DEBUG
org.apache.cassandra.db.monitoring DEBUG
In cassandra.yaml
# can be identified. Set this value to zero to disable slow query logging.
slow_query_log_timeout_in_ms: 500
cat logback.xml
[deafult logback xml][1]
[1]: https://github.com/apache/cassandra/blob/trunk/conf/logback.xml
Step is correct, you should check system.log for any logged slow queries. Also, you need to check system_traces keyspace where session and event table created.
I have faced the same issue with version 3.11.4 found some lines are commented in the logback.xml file.
below is the right configuration for enable debug log
<root level="INFO">
<appender-ref ref="SYSTEMLOG" />
<appender-ref ref="STDOUT" />
<appender-ref ref="ASYNCDEBUGLOG" /> <!-- Comment this line to disable debug.log -->
<!--
<appender-ref ref="LogbackMetrics" />
-->
</root>

Changing Log4J configuration in Tibco BW/Designer does not have the desired effect

I tried to setup custom Log4J appenders in Tibco BW/Designer.
I added to <tibco_folder>/bw/5.11/lib/log4j.xml the following appender:
<appender name="TestFile" class="org.apache.log4j.FileAppender">
<param name="file" value="d:/temp/tibco-test.log"/>
<param name="Threshold" value="DEBUG"/>
<param name="append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy MMM dd HH:mm:ss:SSS 'GMT'} %X{offset} %X{engine} %X{role} [%X{msgCategory}] %X{msgcode} %m %n"/>
</layout>
</appender>
and then I added <appender-ref ref="TestFile"/> to each logger, including bw.logger, beside the tibco_bw_log appender. The messages are sent to tibco_bw_log, but not to my appender.
My appender is getting only some logs like the below, logs that don't appear in tibco_bw_log appender (c:\Users\<me>\.TIBCO\logs\<app_name>.log)
2017 Feb 21 17:05:16:693 GMT [] no system property set, defaulting to entrust61 since got class com.entrust.toolkit.security.provider.Initializer
2017 Feb 21 17:05:16:698 GMT [] getVendor()=entrust61
2017 Feb 21 17:05:16:719 GMT [] Initializing Entrust crypto provider in NON FIPS 140-2 mode; insert provider as normal
2017 Feb 21 17:05:17:302 GMT [] using X9_31usingDESede
2017 Feb 21 17:05:18:021 GMT [] getVendor()=entrust61
2017 Feb 21 17:05:18:023 GMT [] Initialized crypto vendor entrust61
java.lang.Exception: FOR TRACING ONLY -- NOT AN ERROR
at com.tibco.security.impl.new.F.init(CryptoVendor.java:69)
...
Even if I remove the tibco_bw_log appender from bw.logger, the logs are still going there and not to my logger. I changed my appender name to tibco_bw_log and removed the original appender, but then I was getting the error: "org.apache.log4j.FileAppender cannot be cast to com.tibco.share.util.BWLogFileAppender".
Now I don't even get that error, but my appender does not get any logs.
Every time I changed the log4j.xml file, I restarted the Designer. I also applied the same changes to log4j.properties and even removed it. It seems that log4j.xml is taking priority anyway.
I also tried to specify the full path of log4j.xml in bwengine.xml for bw.log4j.configuration and adding the two below properties (as shown here) - no effect.
<property>
<name>bw.engine.showInput</name>
<option>bw.log4j.configuration</option>
<default>true</default>
<description>Log4j Configuration file path</description>
</property>
<property>
<name>bw.engine.showOutput</name>
<option>bw.log4j.configuration</option>
<default>true</default>
<description>Log4j Configuration file path</description>
</property>
I'm using BW 5.11 and Designer 5.8.
What am I missing?
Unfortunately this is not possible in Tibco. Only Java activities can be used with custom loggers.

Excessive console messages from Kafka Producer

How do you control the console logging level of a Kafka Producer or Consumer? I am using the Kafka 0.9 API in Scala.
Every time send on the KafkaProducer is called, the console gives output like below. Could this indicate I do not have the KafkaProducer set up correctly, rather than just an issue of excessive logging?
17:52:21.236 [pool-10-thread-7] INFO o.a.k.c.producer.ProducerConfig - ProducerConfig values:
compression.type = none
metric.reporters = []
metadata.max.age.ms = 300000
.
.
.
17:52:21.279 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bufferpool-wait-time
17:52:21.280 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name buffer-exhausted-records
17:52:21.369 [pool-10-thread-7] DEBUG org.apache.kafka.clients.Metadata - Updated cluster metadata version 1 to Cluster(nodes = [Node(-1, localhost, 9092)], partitions = [])
17:52:21.369 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name connections-closed:client-id-producer-2
17:52:21.369 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name connections-created:client-id-producer-2
17:52:21.370 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bytes-sent-received:client-id-producer-2
17:52:21.370 [pool-10-thread-7] DEBUG o.a.kafka.common.metrics.Metrics - Added sensor with name bytes-sent:client-id-producer-2
.
.
There are logging configurations in the properties files the Kafka server and Zookeeper look at, but I've assumed these do not affect Kafka clients. Changing some of the logging configurations in these files, and restarting the Kafka server and Zookeeper so those files are reloaded, has not solved the problem.
Thank you
add logger with name org.apacha.kafka on your logback.xml
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
</appender>
<logger name="org.apache.kafka" level="warn">
<appender-ref ref="STDOUT" />
</logger>
<root level="info">
<appender-ref ref="STDOUT" />
</root>
Add this to your client code.
Logger.getLogger("org").setLevel(Level.WARNING);
Logger.getLogger("akka").setLevel(Level.WARNING);
Logger.getLogger("kafka").setLevel(Level.WARNING);
Correctly configuring logback solved my problem:
http://www.mkyong.com/logging/logback-xml-example/

akka, spray, and log4j2 not logging right

I am scaffolding a new application in Akka, Spray, and Log4j2. I have most of the major systems working in "hello world" type mode, but I'm having a hard time getting the logging to work as I want and I can't tell if this is a log4j2 issue, an Akka/Spray issue, or a retarded me issue.
First, my Akka config file
akka {
loggers = ["akka.event.slf4j.Slf4jLogger"]
loglevel = DEBUG
log-config-on-start = on
actor{
debug {
receive = on
autoreceive = on
lifecycle = on
fsm = on
event-stream = on
unhandled = on
router-misconfiguration = on
}
}
}
Now, if I comment out the loggers line and run the app in IntelliJ, its perfect in the console. I get everything I want, I get very verbose and helpful logs, I get the config settings, I see the transactions coming in and going out, I'm a very happy person. The problem occurs when I try to pipe it thru Log4j2.
Now the reason I want to do this is in the not too distant future, i'm going to be pumping all logs to a Cassandra cluster for mapreduce work.
So I uncomment the slf4j line in the config file above, add slf4j, log4j2 and log4j2's log4j-slf4j-impl in the classpath and log4j activates, reads the config file, creates the log file, logs to the console the initializing of the appenders and the debug info, and thats it. nothing else comes out. not one blessed thing. nada.
here's my log4j2.xml file
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="DEBUG">
<appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%-5p %c{2} - %m%n" />
</Console>
<RollingRandomAccessFile name="logFileOutput" fileName="logs/wisdomOutput.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<pattern>%d %p %C [%t] %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
</appenders>
<loggers>
<!-- if you want to dump different packages to different files, here's where you do it
<logger name="com.onuspride" level="DEBUG" additivity="false">
<appender-ref ref="logFileOutput"/>
</logger>-->
<root>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="logFileOutput"/>
</root>
</loggers>
</configuration>
I don't know if I'm dealing with a bug in log4j2, or if my configuration file is wrong, or what.
Here is my console output when my logging is activated
/usr/lib/jvm/java-7-oracle/bin/java -Didea.launcher.port=7533 -Didea.launcher.bin.path=/home/willie/apps/intellij13/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfxrt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-7-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-7-oracle/jre/lib/ext/sunjce_provider.jar:/home/willie/code/onus/collective/build/production/wisdom:/home/willie/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-reflect/2.10.0/10ec1256a6e875e886fec050edb0669166912d0d/scala-reflect-2.10.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-routing/1.2.0/955690e1d6b0d92f06da4b53a185a0d59615e1c6/spray-routing-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.json4s/json4s-ast_2.10/3.2.6/e52c46c51f75a7536c3ffedefdbdc331ffaecbdd/json4s-ast_2.10-3.2.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-http/1.2.0/ba24112e069e61224255f6c3cf85727767351fcc/spray-http-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.json4s/json4s-core_2.10/3.2.6/c89c64b04fec958fc57a271bc741dfde759d8ffc/json4s-core_2.10-3.2.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.thoughtworks.paranamer/paranamer/2.6/52c3c8d8876440d714e23036eb87bcc4244d9aa5/paranamer-2.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-util/1.2.0/efea073f15b79a3f62f1f16b22cfcad9a2119439/spray-util-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.json4s/json4s-native_2.10/3.2.6/3728a03373e3eac2354ea0cc855fef71fe97d82e/json4s-native_2.10-3.2.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-compiler/2.10.0/fec8066cd2b4f8dc7ff7ba7a8e0a792939d9f9a/scala-compiler-2.10.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.jvnet.mimepull/mimepull/1.9.3/c55096ff89a27e22c2e081371d0570ac19cc6788/mimepull-1.9.3.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.parboiled/parboiled-scala_2.10/1.1.6/bc93b215151f7dc42653f3eb0243b3130a7e1e11/parboiled-scala_2.10-1.1.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.chuusai/shapeless_2.10/1.2.4/2f41ccc19eb4d38ae5ef907ce7469003e0253dc5/shapeless_2.10-1.2.4.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.parboiled/parboiled-core/1.1.6/11bd0c34fc6ac3c3cbf440ab8180cc6422c044e9/parboiled-core-1.1.6.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-httpx/1.2.0/328e8d28cd3fcd7a7aea6467048a17577d427272/spray-httpx-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.scala-lang/scalap/2.10.0/ab42ae21d1fd7311b367fe3d7f33343f2e4bff6b/scalap-2.10.0.jar:/home/willie/code/onus/collective/build/production/inclusive:/home/willie/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-web/3.1.4.RELEASE/56d52794df838d0bc3ccbc149a62ea019946f82a/spring-security-web-3.1.4.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.3.0/f5e853a20b60758922453d56f9ae1e64af5cb3da/jackson-annotations-2.3.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.1/5043bfebc3db072ed80fbd362e7caf00e885d8ae/commons-logging-1.1.1.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/3.0.7.RELEASE/c53d9bf4e6a6a6cf49c7d7630e612042364295a1/spring-jdbc-3.0.7.RELEASE.jar:/home/willie/.m2/repository/org/springframework/social/spring-social-security/1.1.0.M4/spring-social-security-1.1.0.M4.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webmvc/3.2.3.RELEASE/6d6d1b53c53dbefd0d8c15f2d5c194ced1f8d53c/spring-webmvc-3.2.3.RELEASE.jar:/home/willie/.m2/repository/org/springframework/social/spring-social-web/1.1.0.M4/spring-social-web-1.1.0.M4.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/3.2.3.RELEASE/accdd65db57e79e49f2af037bb76f5a55a580f00/spring-core-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/235ba8b489512805ac13a8f9ea77a1ca5ebe3e8/aopalliance-1.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework.security/spring-security-core/3.1.4.RELEASE/41af4a10d7e31722bd8ef2c101f60afb6c24e04b/spring-security-core-3.1.4.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/javax.inject/javax.inject/1/6975da39a7040257bd51d21a231b76c915872d38/javax.inject-1.jar:/home/willie/.m2/repository/org/springframework/social/spring-social-core/1.1.0.M4/spring-social-core-1.1.0.M4.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/3.2.3.RELEASE/a48eb92ef51e0aed7d23dcaa54225b8f24808db4/spring-beans-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/3.2.3.RELEASE/51e4c94a79892c0a2d15c5efda8c5b336ebf5c37/spring-expression-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/3.2.3.RELEASE/833c5e9a60f82209a3f669a5026dfa8de57c1df3/spring-web-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/3.2.3.RELEASE/12ad5920647556704f79cc579d4e133430741c5/spring-context-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/3.2.3.RELEASE/a70bec95e45a29cad126d250699d0ed0fedfe28a/spring-aop-3.2.3.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/3.0.7.RELEASE/c340bf8606f6bf235bc1277d25315df1abe51c31/spring-tx-3.0.7.RELEASE.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-can/1.2.0/4a3ec8def45e7f567739fe15a6537f57316612bf/spray-can-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/io.spray/spray-io/1.2.0/35c2866c4c7ac7f9b4ee2c06df18075a5bb8c55b/spray-io-1.2.0.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.0-beta9/1dd66e68cccd907880229f9e2de1314bd13ff785/log4j-api-2.0-beta9.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-core/2.0-beta9/678861ba1b2e1fccb594bb0ca03114bb05da9695/log4j-core-2.0-beta9.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.scala-lang/scala-library/2.10.3/21d99cee3d3e478255ef9fcc90b571fb2ab074fc/scala-library-2.10.3.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.typesafe/config/1.0.2/a0bca82c39f23f75e3afccd6e12840eeabaea123/config-1.0.2.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.typesafe.akka/akka-actor_2.10/2.2.3/3a74ea5a7ec2a23fa22077c4debebf96f015dc73/akka-actor_2.10-2.2.3.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.5/6b262da268f8ad9eff941b25503a9198f0a0ac93/slf4j-api-1.7.5.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.typesafe.akka/akka-slf4j_2.10/2.2.3/616c79a2d66ebd136bf0a4e5902bcd1e74dd4cb1/akka-slf4j_2.10-2.2.3.jar:/home/willie/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-slf4j-impl/2.0-beta9/e970fc3c10144a521d691db4ac38027cc1935b74/log4j-slf4j-impl-2.0-beta9.jar:/home/willie/.gradle/caches/modules-2/files-2.1/com.lmax/disruptor/3.2.0/ac62995678dd4b906e85b26354aa2ebfda130c32/disruptor-3.2.0.jar:/home/willie/apps/intellij13/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain com.onuspride.wisdom.Boot
2014-01-10 17:42:36,673 DEBUG Generated plugins in 0.000064883 seconds
2014-01-10 17:42:36,719 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%-5p %c{2} - %m%n", Configuration(/home/willie/code/onus/collective/build/production/wisdom/log4j2.xml), null, charset="null", alwaysWriteExceptions="null")
2014-01-10 17:42:36,721 DEBUG Generated plugins in 0.000061321 seconds
2014-01-10 17:42:36,727 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.ConsoleAppender for element Console with params(PatternLayout(%-5p %c{2} - %m%n), null, target="SYSTEM_OUT", name="CONSOLE", follow="null", ignoreExceptions="null")
2014-01-10 17:42:36,729 DEBUG Calling createLayout on class org.apache.logging.log4j.core.layout.PatternLayout for element PatternLayout with params(pattern="%d %p %C [%t] %m%n", Configuration(/home/willie/code/onus/collective/build/production/wisdom/log4j2.xml), null, charset="null", alwaysWriteExceptions="null")
2014-01-10 17:42:36,732 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.TimeBasedTriggeringPolicy for element TimeBasedTriggeringPolicy with params(interval="null", modulate="null")
2014-01-10 17:42:36,735 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.SizeBasedTriggeringPolicy for element SizeBasedTriggeringPolicy with params(size="50 MB")
2014-01-10 17:42:36,743 DEBUG Calling createPolicy on class org.apache.logging.log4j.core.appender.rolling.CompositeTriggeringPolicy for element Policies with params(Policies={TimeBasedTriggeringPolicy, SizeBasedTriggeringPolicy(size=52428800)})
2014-01-10 17:42:36,748 DEBUG Calling createStrategy on class org.apache.logging.log4j.core.appender.rolling.DefaultRolloverStrategy for element DefaultRolloverStrategy with params(max="20", min="null", fileIndex="null", compressionLevel="null", Configuration(/home/willie/code/onus/collective/build/production/wisdom/log4j2.xml))
2014-01-10 17:42:36,754 DEBUG Calling createAppender on class org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender for element RollingRandomAccessFile with params(fileName="logs/wisdomOutput.log", filePattern="logs/${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz", append="null", name="logFileOutput", immediateFlush="null", Policies(CompositeTriggeringPolicy{TimeBasedTriggeringPolicy, SizeBasedTriggeringPolicy(size=52428800)}), DefaultRolloverStrategy(DefaultRolloverStrategy(min=1, max=20)), PatternLayout(%d %p %C [%t] %m%n), null, ignoreExceptions="null", advertise="null", advertiseURI="null", Configuration(/home/willie/code/onus/collective/build/production/wisdom/log4j2.xml))
2014-01-10 17:42:36,763 DEBUG Starting RollingRandomAccessFileManager logs/wisdomOutput.log
2014-01-10 17:42:36,767 DEBUG Generated plugins in 0.000057060 seconds
2014-01-10 17:42:36,772 DEBUG Calling createAppenders on class org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element appenders with params(Appenders={CONSOLE, logFileOutput})
2014-01-10 17:42:36,773 DEBUG Generated plugins in 0.000052311 seconds
2014-01-10 17:42:36,777 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="CONSOLE", level="null", null)
2014-01-10 17:42:36,778 DEBUG Calling createAppenderRef on class org.apache.logging.log4j.core.config.AppenderRef for element appender-ref with params(ref="logFileOutput", level="null", null)
2014-01-10 17:42:36,783 DEBUG Calling createLogger on class org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element root with params(additivity="null", level="null", includeLocation="null", AppenderRef={CONSOLE, logFileOutput}, Properties={}, Configuration(/home/willie/code/onus/collective/build/production/wisdom/log4j2.xml), null)
2014-01-10 17:42:36,787 DEBUG Calling createLoggers on class org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element loggers with params(Loggers={root})
2014-01-10 17:42:36,799 DEBUG Reconfiguration completed
2014-01-10 17:42:36,808 DEBUG Using default SystemClock for timestamps
2014-01-10 17:42:36,815 DEBUG property AsyncLogger.WaitStrategy=null
2014-01-10 17:42:36,815 DEBUG disruptor event handler uses SleepingWaitStrategy
2014-01-10 17:42:37,045 DEBUG No AsyncLogger.ExceptionHandler specified
2014-01-10 17:42:37,058 DEBUG Starting AsyncLogger disruptor with ringbuffer size 262144...
I guess my problem is I can't figure out how to channel stdout from Akka, thru log4j2 to be formatted, and then written to a file. For the time being I really don't want to be any more complex than that.
What is wrong with my setup? Why isn't this working?
figure it out. here's my config
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="debug">
<appenders>
<!--<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%-5p %c{2} - %m%n" />
</Console>-->
<RollingRandomAccessFile name="logFileOutput" fileName="logs/wisdomOutput.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout>
<pattern>%d %p %C [%t] %m%n</pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
<SizeBasedTriggeringPolicy size="50 MB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
</appenders>
<loggers>
<!-- if you want to dump different packages to different files, here's where you do it
<logger name="com.onuspride" level="DEBUG" additivity="false">
<appender-ref ref="logFileOutput"/>
</logger>-->
<root level="debug" includeLocation="true">
<!--<appender-ref ref="CONSOLE"/>-->
<appender-ref ref="logFileOutput"/>
</root>
</loggers>
</configuration>
All looks good, I think you just need to set the log level of the root logger (looks like you already found that).
One small thing: in the RollingFile appender PatternLayout you are using %C.
I recommend you use %c (lowercase) instead. %C walks the stack trace to get location info and will give much worse performance. (The log4j2 manual has more details.)

Resources