Hello,
I am facing a new issue with my Logstash configuration.
It follows the previous subject I opened : Log4j SocketAppender. Logstash : tcp input --> OK, log4j input --> KO - SOLVED - #20 by wiibaa
I am receiving the logs and they are properly de-serialized as I can see them via Kibana.
But I am receiving a lot of errors in the stderr.log file (always the same) :
log4j:WARN Level deserialization failed, reverting to default.
java.lang.NoSuchMethodException: com.eibus.util.logger.Severity.toLevel(int)
at java.lang.Class.getDeclaredMethod(Class.java:2130)
at org.apache.log4j.spi.LoggingEvent.readLevel(LoggingEvent.java:436)
at org.apache.log4j.spi.LoggingEvent.readObject(LoggingEvent.java:463)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1900)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.jruby.ext.jruby.JRubyObjectInputStream.readObject(JRubyObjectInputStream.java:56)
at org.jruby.ext.jruby.JRubyObjectInputStream$INVOKER$i$0$0$readObject.call(JRubyObjectInputStream$INVOKER$i$0$0$readObject.gen)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:56)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:134)
at org.jruby.ast.CallNoArgNode.interpret(CallNoArgNode.java:60)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.LocalAsgnNode.interpret(LocalAsgnNode.java:123)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:105)
. . .
at org.jruby.evaluator.ASTInterpreter.INTERPRET_BLOCK(ASTInterpreter.java:112)
at org.jruby.runtime.Interpreted19Block.evalBlockBody(Interpreted19Block.java:206)
at org.jruby.runtime.Interpreted19Block.yield(Interpreted19Block.java:194)
at org.jruby.runtime.Interpreted19Block.call(Interpreted19Block.java:125)
at org.jruby.runtime.Block.call(Block.java:101)
at org.jruby.RubyProc.call(RubyProc.java:300)
at org.jruby.RubyProc.call(RubyProc.java:230)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:99)
at java.lang.Thread.run(Thread.java:745)
Where I am surprised is that I have included the following .jar files in the Log4j.rb file :
require "E:\App\ELK\CordysLogger\managementlib.jar"
require "E:\App\ELK\CordysLogger\log4j-1.2.15.jar"
In the managementlib.jar, I can see :
package com.eibus.util.logger;
import java.util.Locale;
import org.apache.log4j.Level;
public class Severity extends Level
{
public static final Severity FATAL = new Severity(50000, "FATAL", 0); public static final Severity ERROR = new Severity(40000, "ERROR", 3); public static final Severity WARN = new Severity(30000, "WARN", 4); public static final Severity INFO = new Severity(20000, "INFO", 6); public static final Severity DEBUG = new Severity(10000, "DEBUG", 7);
private Severity(int severity, String severityStr, int syslogEquivalent) { super(severity, severityStr, syslogEquivalent); }
public static final Severity toSeverity(String level) { String logLevel = level.toUpperCase(Locale.ENGLISH); Severity severity = FATAL; if("DEBUG".equals(logLevel)) { severity = DEBUG; } else if("INFO".equals(logLevel)) { severity = INFO; } else if("WARN".equals(logLevel)) { severity = WARN; } else if("ERROR".equals(logLevel)) { severity = ERROR; } return severity; }
}
So I can see that the Severity class extends the Level one.
By checking in the log4j-1.2.15.jar (that is also included in the Log4j.rb file), I found the Level class and the following toLevel method :
public static Level toLevel(int val) { return toLevel(val, DEBUG); }
Can someone help me with this Java issue ?
Thanks in advance !