[
https://issues.apache.org/jira/browse/LOG4J2-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13650547#comment-13650547
]
Imesh Damith edited comment on LOG4J2-228 at 5/13/13 10:10 AM:
---------------------------------------------------------------
Hi Ramko,
I have another problem. When I try to pass, say two log messages in a row, in
my server side I can get only first log successfully. for the second one it
gave IOException Error : java.io.StreamCorruptedException: invalid stream header
client side is sending below two log messages.
logger.fatal ("test1")
logger.fatal("test 2")
Server side code.
static DatagramSocket socket ;
public void myMethod () {
socket = new DatagramSocket(9095);
DatagramPacket packet = new DatagramPacket(buf, buf.length);
byte[] buf = new byte[100000];
while(true){
try{
logger.debug ("UDPServer Waiting for client on port
"+socket.getLocalPort());
socket.receive(packet);
if (packet.getLength()>0) {
ByteArrayInputStream bis = new
ByteArrayInputStream(packet.getData());
ObjectInputStream obj = new
ObjectInputStream(bis);
LogEvent logEvent = (LogEvent)
obj.readObject();
logger.debug("Got it : " +
logEvent.toString());
}
}catch (IOException e1) {
logger.fatal(" IOException Error : " + e1);
}
logger.info("***********************************************");
} // end of while
} // end of method
And my log print as below.
UDPServer Waiting for client on port 9095
Got it : Logger=rezg.gdsws.util.Logs Level=FATAL Message=test1
// log properly print for the 1st msg
***********************************************
UDPServer Waiting for client on port 9095
IOException Error : java.io.StreamCorruptedException: invalid stream header
// Error for the 2nd msg.
***********************************************
Do you have any idea for this?
Thanks in advance,
Imesh
was (Author: imeshd):
Hi Ramko,
I have another problem. When I try to pass, say two log messages in a row, in
my server side I can get only first log successfully. for the second one it
gave IOException Error : java.io.StreamCorruptedException: invalid stream header
client side is sending below two log messages.
logger.fatal ("test1")
logger.fatal("test 2")
Server side code.
while(true){
try{
logger.debug ("TCPServer Waiting for client on port
"+socket.getLocalPort());
socket.receive(packet);
if (packet.getLength()>0) {
ByteArrayInputStream bis = new
ByteArrayInputStream(packet.getData());
ObjectInputStream obj = new
ObjectInputStream(bis);
LogEvent logEvent = (LogEvent)
obj.readObject();
logger.debug("Got it : " +
logEvent.toString());
}
}catch (IOException e1) {
logger.fatal(" IOException Error : " + e1);
}
logger.info("***********************************************");
}
And my log print as below.
TCPServer Waiting for client on port 9095
Got it : Logger=rezg.gdsws.util.Logs Level=FATAL Message=test1
// log properly print for the 1st msg
***********************************************
TCPServer Waiting for client on port 9095
IOException Error : java.io.StreamCorruptedException: invalid stream header
// Error for the 2nd msg.
***********************************************
Do you have any idea for this?
Thanks in advance,
Imesh
> Log4j2 UDP socket configure error. Class not found
> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
> ------------------------------------------------------------------------------------------------------------------
>
> Key: LOG4J2-228
> URL: https://issues.apache.org/jira/browse/LOG4J2-228
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.0-beta4
> Reporter: Remko Popma
> Assignee: Ralph Goers
> Attachments: log4j2.xml, Logs_test.java, pom.xml, TCPServer_test.java
>
>
> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
> Hi,
> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
> But I got below error in the server side.
> ClassNotFoundException Error : java.lang.ClassNotFoundException:
> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
> Below is my server side code.
> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
> ObjectInputStream obj = new ObjectInputStream(bis);
> LogEvent logEvent = (LogEvent) obj.readObject();
> System.out.println(logEvent.toString());
> Below is my pom.xml file dependency.
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-api</artifactId>
> <version>2.0-beta4</version>
> </dependency>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-core</artifactId>
> <version>2.0-beta4</version>
> </dependency>
> Thanks in advance,
> Imesh
--
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: [email protected]
For additional commands, e-mail: [email protected]