Error in OtrosLogViewer

1.1k views Asked by At

i'm using OtrosLogViewer to analyze my glassfish log file. But it seems the software not working. I think my pattern is wrong.

type=log4j
customLevels=SEVERE=FATAL,WARNING=WARN,CONFIG=INFO,FINE=DEBUG,FINER=TRACE,FINEST=TRACE,INFO=INFO
pattern=[#|TIMESTAMP|LEVEL|PROP(ProductName-Version)|LOGGER|_ThreadID=PROP(ThreadID);_ThreadName=THREAD;PROP(Properties);|MESSAGE|#]
dateFormat=yyyy-MM-dd'T'HH:mm:ss.SSSZ
name=GlassFish logger
charset=UTF-8

Here's my example of server log (Glassfish 4.0) :

[2013-10-13T17:36:03.841+0700] [glassfish 4.0] [WARNING] [endpoint.activation.failure] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.inbound] [tid: _ThreadID=34 _ThreadName=admin-listener(1)] [timeMillis: 1381660563841] [levelValue: 900] [[
RAR8501: Exception during endpoint activation for ra [ jmsra ], activationSpecClass [ com.sun.messaging.jms.ra.ActivationSpec ] : javax.resource.ResourceException: MQRA:EC:Invalid destinationLookup jms/NewMessage configured in ActivationSpec of MDB for no JNDI name found]]

[2013-10-13T17:36:03.841+0700] [glassfish 4.0] [SEVERE] [containers.mdb.create_container_exception] [javax.enterprise.system.container.ejb.mdb.org.glassfish.ejb.mdb] [tid: _ThreadID=34 _ThreadName=admin-listener(1)] [timeMillis: 1381660563841] [levelValue: 1000] [[
MDB00017: [NewMessage]: Exception in creating message-driven bean container: [java.lang.Exception]]]

How to modify my pattern to make it work? i'm quite confused about OtrosLogViewer's pattern.

Thanks.

2

There are 2 answers

0
KrzyH On BEST ANSWER

You can use these format to parse log in your question:

type=log4j
pattern=[TIMESTAMP] [PROP(server)] [CLASS] [LEVEL] [PROP(someClass)] [tid: _ThreadID=PROP(ThreadID) _ThreadName=THREAD] [timeMillis: PROP(timeMilis)] [levelValue: PROP(levelValue)] MESSAGE
name=My glassfish format
dateFormat=yyyy-MM-dd'T'HH:mm:sZ

I had following assumption about your log:

[2013-10-13T17:36:03.841+0700] - timestamp
[glassfish 4.0] - PROP(server)
[WARNING]  - Level
[endpoint.activation.failure] - Class
[javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.inbound] PROP(someClass)
[tid: _ThreadID=34 _ThreadName=admin-listener(1)] - Thread info
[timeMillis: 1381660563841]  - PROP(timeMillis)
[levelValue: 900] - PROP(levelValue)
[[RAR8501: Exception during endpoint activation for ra [ jmsra ], activationSpecClass [ com.sun.messaging.jms.ra.ActivationSpec ] : javax.resource.ResourceException: MQRA:EC:Invalid destinationLookup jms/NewMessage configured in ActivationSpec of MDB for no JNDI name found]] - Message

OtrosLogViewer has also Log4j pattern parser editor. You can found it in menu Tools.

0
Sym-Sym On

Glassfish server log uses Java Util Logging (JUL). OtrosLogViewer can read a log file produced by JUL using SimpleFormatter or XMLFormatter - and both are not my points of strength. That said, I can show you how to use OtrosLogViewer while making it recognize Log4j PatternLayout .

Given the following log4j.properties file

log4j.rootLogger=debug, logfile
log4j.appender.logfile=org.apache.log4j.RollingFileAppender
log4j.appender.logfile.MaxFileSize=20000KB
log4j.appender.logfile.MaxBackupIndex=3
log4j.appender.logfile.File=logs/MyAppLog.log
log4j.appender.logfile.append=false
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.conversionPattern=%d{MM-dd@HH:mm:ss} %-5p (%13F:%L) %C %M - %m%n

Place the following MyLog4jPattern.pattern in the folder olv-folder\plugins\logimporters

type=log4j
pattern=TIMESTAMP LEVEL (FILE:LINE) CLASS METHOD - MESSAGE
dateFormat=MM-dd@HH:mm:ss
name="My Custom pattern: "%d{ISO8601} %-5p (%13F:%L) %C %M - %m%n"
charset=UTF-8

Then re-start OtrosLogViewer. Open or tail your log file using the button tagged "My Custom pattern:..."

I hope this helps!