Set both socket server process and local process log4j2's configuration status to debug. I don't see any errors.
socket service process output: 2015-02-12 09:54:44,526 DEBUG Started configuration XmlConfiguration[location=/opt/twc/ecp/log4j2.server.xml] OK. local process output: 2015-02-12 10:29:37,481 DEBUG Started configuration XmlConfiguration[location=/Users/tczutno/Perforce/tara-mac3/ECP/dev/ecp-MAIN/service/target/test-classes/log4j2-test.xml] OK. The socket server log file is getting log lines, but no stack traces on exceptions. Is anyone else able to get TcpSocketServer to log a stack trace on exception? Any other suggestions? On Wed, Feb 11, 2015 at 8:19 PM, Ralph Goers <[email protected]> wrote: > try setting the configuration status to debug to see if you are getting > any errors during initialization. > > Ralph > > > On Feb 11, 2015, at 2:05 PM, Tara Czutno <[email protected]> > wrote: > > > > We updated our codebase recently from log4j2 v2.0-rc1 to v2.1. We use a > > SocketServer. Once we did upgraded, we are not seeing exception stack > > traces on lines where we used to. For example: > > try { > > throw new RuntimeException("Do you now to log my stackTrace? > > stringstringstringE"); > > } catch (Exception e) { > > LOGGER.error("Do you now to log my stackTrace? a:{} b:{} c:{} > Yes, > > I do!", "3443","4444","55555",e); > > } > > Does not give the stack trace. Running locally with a test log4j2 config > > just writing to a file will give the stack trace. > > > > Any ideas what changed? > > > > We do use slf4j v.1.7.10 but that doesn't seem to be a factor because it > > works locally with a test log4j2 config and also with the old > SocketServer > > and log4j2 v2.0-rc1. > > > > We use a SocketServer so we also had to upgrade to TcpSocketServer. > > Perhaps something has changed? > > > > We start our socket server like: > > > >> /usr/bin/java > >> > -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector > >> -DgrepToken=org.apache.logging.log4j.core.net.server.TcpSocketServer > >> -server -Xms64M -Xmx256M -XX:+UseG1GC -XX:MaxGCPauseMillis=200 > >> -XX:GCPauseIntervalMillis=400 -Djava.net.preferIPv4Stack=true -cp > >> /opt/twc/ecp:/opt/twc/ecp/lib/* > >> org.apache.logging.log4j.core.net.server.TcpSocketServer 6000 > >> /opt/twc/ecp/log4j2.server.xml > > > > The socket server process uses log4j2 config: > > > >> <?xml version="1.0" encoding="UTF-8"?> > >> > >> <Configuration name="log4j2.server.xml" status="info"> > >> > >> <Appenders> > >> > >> <RollingFile name="File" fileName="/opt/twc/logs/ecp.log" > >> filePattern="/opt/twc/logs/ecp.log.%d{yyyy-MM-dd}" append="true" > >> bufferedIO="true" immediateFlush="true"> > >> > >> <PatternLayout> > >> > >> <Pattern>%d{ISO8601} %-14mdc{application} %-5level [%t] > >> %logger - %msg%n</Pattern> > >> > >> </PatternLayout> > >> > >> <Policies> > >> > >> <TimeBasedTriggeringPolicy/> > >> > >> </Policies> > >> > >> </RollingFile> > >> > >> </Appenders> > >> > >> <Loggers> > >> > >> <Root level="all" includeLocation="true"> > >> > >> <AppenderRef ref="File"/> > >> > >> </Root> > >> > >> </Loggers> > >> > >> </Configuration> > >> > > The local process uses log4j2 config: > > > >> <?xml version="1.0" encoding="UTF-8"?> > >> > >> <Configuration status="info" name="log4j2.xml" monitorInterval="60"> > >> > >> <Appenders> > >> > >> <Socket name="socket" host="ent06.lab.mystrotv.com" port="6000" > >>> protocol="TCP" reconnectionDelay="1000" includeLocation="true"> > >> > >> <SerializedLayout/> > >> > >> </Socket> > >> > >> </Appenders> > >> > >> > >>> <Loggers> > >> > >> <Logger name="com.google" level="error" includeLocation="true"/> > >> > >> <Logger name="org.mybatis" level="error" includeLocation="true"/> > >> > >> <Logger name="org.apache.ibatis" level="error" > >>> includeLocation="true"/> > >> > >> <Logger name="com.ryantenney" level="error" > includeLocation="true"/> > >> > >> <Logger name="org.apache.http" level="error" > >>> includeLocation="true"/> > >> > >> <Logger name="org.apache.activemq" level="error" > >>> includeLocation="true"/> > >> > >> <Logger name="org.eclipse.jetty" level="error" > >>> includeLocation="true"/> > >> > >> <Logger name="org.apache.cxf" level="error" > includeLocation="true"/> > >> > >> > >>> <Logger name="org.springframework" level="info" > >>> includeLocation="true"/> > >> > >> <Logger > >>> name="com.twc.ctg.ecp.service.history.HouseholdHistorySummaryQueue" > >>> level="warn" includeLocation="true"/> > >> > >> <Logger > >>> > name="com.twc.ctg.ecp.persistence.mappers.HouseholdHistorySummaryMapper" > >>> level="warn" includeLocation="true"/> > >> > >> > >>> <Root level="info" includeLocation="true"> > >> > >> <AppenderRef ref="socket"/> > >> > >> </Root> > >> > >> </Loggers> > >> > >> </Configuration> > >> > >> > > Any ideas? > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
