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 "Robert Breunung (JIRA)" <ji...@apache.org> on 2012/10/11 18:45:03 UTC

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

Robert Breunung created LOG4J2-96:
-------------------------------------

             Summary: 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


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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ 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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475807#comment-13475807 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

Like in bug 95 I could provide a demo for the Eclipse universe. Would this be a help?
                
> 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
>            Assignee: Ralph Goers
>              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


[jira] [Comment Edited] (LOG4J2-96) Error with SocketServer

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475850#comment-13475850 ] 

Ralph Goers edited comment on LOG4J2-96 at 10/14/12 3:45 PM:
-------------------------------------------------------------

It might, but I'm having a hard time reconciling the problem report with the code. If you look at SerializedLayout you will see that it sets the header by opening an ObjectOutputStream and then immediately closing it.  It then has a private class that overrides ObjectObjectStream to specifically prevent the header from being written with each object. SocketAppender extends OutputStreamAppender and OutputStreamAppender calls manager.setHeader() which is where the header is actually written to the outputStream. It isn't even stored in a variable. 

In addition, the unit test is calling logger.debug twice and is able to get the events from the List where they were placed by the SocketServer so even without eclipse I'm having a hard time understanding how this could happen without a completely new SocketAppender and AppenderManager somehow writing to the stream.

Can you provide a sample app that shows the failure? If not, could you walk through the flow and figure out how the header is being added for the second object?
                
      was (Author: ralph.goers@dslextreme.com):
    It might, but I'm having a hard time reconciling the problem report with the code. If you look at SerializedLayout you will see that it sets the header by opening an ObjectOutputStream and then immediately closing it.  It then has a private class that overrides ObjectObjectStream to specifically prevent the header from being written with each object. SocketAppender extends OutputStreamAppender and OutputStreamAppender calls manager.setHeader() which is where the header is actually written to the outputStream. It isn't even stored in a variable. 

In addition, the unit test is calling logger.debug twice and is able to get the events from the List where they were placed by the SocketServer so even without eclipse I'm having a hard time understanding how this could happen without a completely new SocketAppender and AppenderManager somehow writing to the stream.

Can you provide a sample app that shows the failure?
                  
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13475850#comment-13475850 ] 

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

It might, but I'm having a hard time reconciling the problem report with the code. If you look at SerializedLayout you will see that it sets the header by opening an ObjectOutputStream and then immediately closing it.  It then has a private class that overrides ObjectObjectStream to specifically prevent the header from being written with each object. SocketAppender extends OutputStreamAppender and OutputStreamAppender calls manager.setHeader() which is where the header is actually written to the outputStream. It isn't even stored in a variable. 

In addition, the unit test is calling logger.debug twice and is able to get the events from the List where they were placed by the SocketServer so even without eclipse I'm having a hard time understanding how this could happen without a completely new SocketAppender and AppenderManager somehow writing to the stream.

Can you provide a sample app that shows the failure?
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488094#comment-13488094 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

How many appenders should have been created? I saw an appender initialized per class.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488335#comment-13488335 ] 

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

OK. Some sort of sample app would definitely help me here.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13487803#comment-13487803 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

I will try to build a minimal example for you. I think the problem might be connected with different class loaders from different plugins. The Logger worked for multiple (2) Messages from the same plugin, but stopped after a class from another plugin also tried to use it.

I will write a second comment later, after reviewing the problem again.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13476038#comment-13476038 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

I did read the source and I also came through the changes you mention. I was also wandering what could possibly be wrong. Could there be an interaction with class loaders or threads?

I observed following behaviour:
The first logging message (main thread, first plugin) from my Application is recieved correctly. on The second I get the error. I tried to skip the header and called the object input stream to skip 4 bytes. After this the second message (same plugin and different thread) also worked. But now it always stops at the third message(main thread but other plugin). No matter how many bytes I order to skip, it always stops with the same error. Of course this is a little strange, as there can't be at all positions in the stream the same content? I didn't verify it yet. Maybe the skip method does not work the way I expect.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13500086#comment-13500086 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

I want to do. I just didn't have the time.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ralph Goers reassigned LOG4J2-96:
---------------------------------

    Assignee: Ralph Goers
    
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13487195#comment-13487195 ] 

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

Can you describe your application a bit more so that I can create an Eclipse project that simulates it?
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Robert Breunung (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488177#comment-13488177 ] 

Robert Breunung commented on LOG4J2-96:
---------------------------------------

I have a kind of a root application plugin with all the jars necessary. There I can export the necessary namespace visibilities to all depending plugins. The root plugin also is the only place wth a log4j2.xml configuration file. All plugins are logging into the same setup.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13488138#comment-13488138 ] 

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

I don't think I understand, or maybe I misunderstood before.  Do you have multiple plugins each with their own Log4j jars?  The default LoggerContext is the ClassLoaderContextSelector. With that you will get a new configuration - and hence a new Appender - with each ClassLoader. But if the Log4j jars are somewhere that they are being shared you will only have a single AppenderManager that is shared by both Appenders.  So it is important for me to know how you are using Log4j before I can give you an answer.
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13500020#comment-13500020 ] 

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

Can you provide a sample application?
                
> 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
>            Assignee: Ralph Goers
>              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


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

Posted by "Ralph Goers (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LOG4J2-96?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13487851#comment-13487851 ] 

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

If I understand your previous message, you have two plugins that are each writing to the SocketServer.  Each of those plugins is isolated in its own bundle and so has its own SocketAppender and SocketManager. In that case what you are describing makes perfect sense and would be expected as the Appenders/Managers don't know about each other and think they are the only one writing to the socket. Given how ObjectOutputStream works I don't think you can use SerializedLayout. Instead we will have to use a different Serialization mechanism that doesn't differentiate between the first and subsequent objects.
                
> 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
>            Assignee: Ralph Goers
>              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