Reputation: 15552
Does anyone know how I can reduce the width of each line on a glassfish log. It seems to contain lots of information that I do not need. Below is an example of one line.
[#|2012-03-04T16:00:09.537+0000|INFO|oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-1;|16:00:09,537 INFO MyClassNameThatIsLogging:89 - LogMessageHere
All I really care about is:
2012-03-04T16:00:09.537+0000
)INFO
)MyClassNameThatisLogging:89
)LogMessageHere
)I dont care about this part
oracle-glassfish3.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=94;_ThreadName=Thread-1;
Where is this configured?
I have found Install log formater in glassfish, but it seems a bit extreme. Do I really have to create my own logger?
Thanks in advance
Upvotes: 3
Views: 1741
Reputation: 2069
A custom log handler seems to be the only option here.
The glassfish admin guide does describes the log format in detail:
[#|yyyy-mm-ddThh:mm:ss.SSS-Z|Log Level|ProductName-Version|LoggerName|Key Value Pairs|Message|#]
From: Glassfish Admin Guide, Log Records
Further on it states:
By default, Oracle GlassFish Server log records are captured in a server log file using the format described in Log Records. However, you may find that you want to log messages to a different location, such as a database or a remote server, or log messages from specific loggers to your own file. This can be done by implementing a custom log handler. This section explains how to add a custom log handler to the Oracle GlassFish Server logging service.
From: Glassfish Admin Guide, Adding a Custom Logging Handler
This blog post shows an example implementation.
Upvotes: 2