You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Ralph Goers (JIRA)" <ji...@apache.org> on 2012/10/13 19:16:03 UTC

[jira] [Commented] (LOG4J2-96) Error with SocketServer

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

Ralph Goers commented on LOG4J2-96:
-----------------------------------

Can you provide a test case that shows this?  I modified SocketServerTest to log a second event and it did not fail. SerializedLayout overrides ObjectOutputStream just so it can send the stream header by itself when layout.getHeader() is called. The objects should not include the header since writeStreamHeader in the ObjectOutputStream was overridden to do nothing.
                
> Error with SocketServer
> -----------------------
>
>                 Key: LOG4J2-96
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-96
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta1
>            Reporter: Robert Breunung
>              Labels: appender, layout, server, socket
>
> Hello,
> by using your core.appender.SocketAppender and your core.netSocketServer I found a dissent.
> I am using the default setup of the appender with the SerializedLayout. The first send event to the server is properly deserialized. on the second I get an IOException:
> log4j java.io.StreamCorruptedException: invalid type code: AC 
> I researched the problem and I found a solution here:
> http://stackoverflow.com/questions/2393179/streamcorruptedexception-invalid-type-code-ac
> The appender creates a new output stream for each log event. It writes every time a header. The listening server don't expect a header the second time. Because of this it crashes.
> Sincerely
> Robert Breunung

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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