logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Hsueh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-625) Serialization error with SocketAppender and Asynch Logger
Date Wed, 02 Jul 2014 21:43:25 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14050749#comment-14050749
] 

Bryan Hsueh commented on LOG4J2-625:
------------------------------------

just tested with RC2 and worked, thanks!

> Serialization error with SocketAppender and Asynch Logger
> ---------------------------------------------------------
>
>                 Key: LOG4J2-625
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-625
>             Project: Log4j 2
>          Issue Type: Question
>          Components: Appenders
>    Affects Versions: 2.0-rc1
>         Environment: Ubuntu 12.04, Java 7
>            Reporter: Bryan Hsueh
>            Assignee: Remko Popma
>
> I'm testing a simple SocketAppender, which works fine until I switch to asynchronous
loggers.  Once I turn on async logging, I get:
> 2014-04-29 21:17:26,029 ERROR Serialization of LogEvent failed. java.io.NotSerializableException:
org.apache.logging.log4j.core.Logger$PrivateConfig
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
> 	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
> 	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)
> 	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1431)
> 	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)
> 	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)
> 	at org.apache.logging.log4j.core.layout.SerializedLayout.toByteArray(SerializedLayout.java:64)
> 	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:118)
> 	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:97)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:425)
> 	at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
> 	at org.apache.logging.log4j.core.Logger$PrivateConfig.logEvent(Logger.java:275)
> 	at org.apache.logging.log4j.core.async.AsyncLogger.actualAsyncLog(AsyncLogger.java:289)
> 	at org.apache.logging.log4j.core.async.RingBufferLogEvent.execute(RingBufferLogEvent.java:99)
> 	at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:43)
> 	at org.apache.logging.log4j.core.async.RingBufferLogEventHandler.onEvent(RingBufferLogEventHandler.java:28)
> 	at com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:128)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:744)
>  My client is configured with:
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="INFO">
>   <Appenders>
>     <Console name="MyConsole" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS}{EST} %-5level- %msg%n"/>
>     </Console>
>     <Socket name="MySocket" host="localhost" port="8888">
>       <SerializedLayout />
>     </Socket>
>   </Appenders>
>   <Loggers>
>     <Root level="INFO">
>       <AppenderRef ref="MyConsole"/>
>       <AppenderRef ref="MySocket"/>
>     </Root>
>   </Loggers>
> </Configuration>
> My server is configured with:
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="INFO">
>   <Appenders>
>     <Console name="MyConsole" target="SYSTEM_OUT">
>       <PatternLayout pattern="%d{HH:mm:ss.SSS}{EST} %-5level- %msg%n"/>
>     </Console>
>   </Appenders>
>   <Loggers>
>     <Root level="INFO">
>       <AppenderRef ref="MyConsole"/>
>     </Root>
>   </Loggers>
> </Configuration>
> The client just does a LogManager.getLogger().info("{}", "hello").
> The server just creates a SocketServer:
> SocketServer server = new SocketServer(8888);
> server.run();
> All works fine until I add this into the client:
> System.setProperty("Log4jContextSelector",                "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> Am I missing something?  Please advise.
> Thanks
>    



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message