Any news on it?
On Thu, Nov 6, 2014 at 3:03 PM, Alexey Zavizionov < [email protected]> wrote: > > Btw, I found "separator" option, but \n or %n didn't work for it! > > <PatternLayout> > <pattern>%d{HH:mm:ss.SSS} : %m [] %xEx{separator(\n)} > %n</pattern> > </PatternLayout> > > I want to use %d in it. > > Please try to fix the with it. > org.apache.logging.log4j.core.pattern.ThrowablePatternConverter.formatOption(Throwable, > StringBuilder) > > > On Thu, Nov 6, 2014 at 10:31 AM, Alexey Zavizionov < > [email protected]> wrote: > >> Thank! Where to put it in my conf to not broke other log configuration? >> 05 нояб. 2014 г. 21:42 пользователь "Ralph Goers" < >> [email protected]> написал: >> >> You would have to create a custom ThrowablePatternConverter. >>> >>> Ralph >>> >>> > On Nov 5, 2014, at 12:03 PM, Alexey Zavizionov < >>> [email protected]> wrote: >>> > >>> > Here is the output, when an application is throwing an exception, >>> logging >>> > it to log, including its stack trace. >>> > >>> > E 1105-2042:17,349 c.e.TestLog error-message [main] >>> > java.lang.Exception: SomeError >>> > at com.examples.TestLog.main(TestLog.java:15) >>> > >>> > Want to see the timestamp "E 1105-2042:17,349" on each log line. >>> > How can I do? Is it possible with configuration file? >>> > >>> > TestLog.java >>> > ============================================= >>> > public class TestLog { >>> > private static final Logger LOGGER = >>> LoggerFactory.getLogger(TestLog.class); >>> > public static void main(String[] args) { >>> > LOGGER.error("error-", new Exception("SomeError")); >>> > } >>> > } >>> > ============================================= >>> > >>> > log4j2.xml >>> > ============================================= >>> > <?xml version="1.0" encoding="UTF-8"?> >>> > <Configuration status="WARN"> >>> > <Appenders> >>> > <RollingRandomAccessFile name="server" fileName="server.log" >>> > filePattern="server-%d-%i.log.zip" immediateFlush="false"> >>> > <ThresholdFilter level="DEBUG" /> >>> > <PatternLayout> >>> > <pattern>%level{length=1} %date{MMdd-HHmm:ss,SSS} >>> > %logger{1.} %message [%thread]%n</pattern> >>> > </PatternLayout> >>> > <Policies> >>> > <TimeBasedTriggeringPolicy /> >>> > <SizeBasedTriggeringPolicy size="50 MB" /> >>> > </Policies> >>> > <DefaultRolloverStrategy max="100" /> >>> > </RollingRandomAccessFile> >>> > </Appenders> >>> > <Loggers> >>> > <Root level="DEBUG"> >>> > <AppenderRef ref="server" /> >>> > </Root> >>> > </Loggers> >>> > </Configuration> >>> > ============================================= >>> > >>> > I have log: >>> > ============================================== >>> > E 1105-2042:17,349 c.e.TestLog error-message [main] >>> > java.lang.Exception: SomeError >>> > at com.examples.TestLog.main(TestLog.java:15) >>> > ============================================== >>> > >>> > Hope to see log: >>> > ============================================== >>> > E 1105-2042:17,349 c.e.TestLog error-message [main] >>> > E 1105-2042:17,349 java.lang.Exception: SomeError >>> > E 1105-2042:17,349 at com.examples.TestLog.main(TestLog.java:15) >>> > ============================================== >>> > >>> > Regards, >>> > Alexey. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >
