Gerald Nunn's Blog
« Configuring the HTPC network card | Main | HTPC and firewire to cable box »Filtering out unnecessary log messages
Monday, June 09, 2008
Sometimes you can have too much of a good thing and once in a while logging falls into that category. In a way logging is like beer, too little of it leaves you feeling unfulfilled whilst too much dulls the senses and makes accomplishing things difficult. Trying to find that middle ground can be difficult, but fortunately it is usually easy to tune the logging subsystem to display just the right level of information for the current situation.
Once in a while though you get into a situation where someone is unintentionally logging messages that are unnecessary and cannot be readily turned off by simply switching to a higher logging level. I recently ran into this situation at a client engagement where the WSRP subsystem in WebLogic Portal was logging a lot of unnecessary messages.
It turns out in this case that the extra logging is caused by a minor issue in Portal with page flows and WSRP. If you have a page flow action that takes a form bean as a parameter this form bean gets passed between the consumer and producer as part of an IPC event that encapsulates the action. The WSRP eventing system is designed to not attempt to deserialize event payloads unless explicitly requested, however due to an issue it does in this case. This leads to a ClassNotFoundException since the form bean class does not exist on the consumer and in turn causes the following message to be logged.
<[java.lang.ClassNotFoundException: portlets.main.TestBean ] Unable to deserialize event payload. See stack trace for details. java.lang.ClassNotFoundException: portlets.main.TestBean at java.lang.Class.forName(Ljava.lang.String;ZLjava.lang.ClassLoader;)Ljava.lang.Class;(Unknown Source) at java.io.ObjectInputStream.resolveClass(Ljava.io.ObjectStreamClass;)Ljava.lang.Class;(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Z)Ljava.io.ObjectStreamClass;(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Z)Ljava.lang.Object;(Unknown Source) Truncated. see log file for complete stacktrace
This message was appearing quite often and made examining the logs more difficult then it needed to be, no longer could the administrators just grep for 'Exception' to find potential issues. The client wanted to eliminate the log message but did not want to raise the log level of the server since they wanted to be able to capture other messages at the Warning level.
Fortunately a workaround to the issue was relatively easy. WebLogic Server has a feature called Log Filters that is accessed through the WLS console that allows an administrator to determine what is or is not logged by evaluating a simple expression. In addition to an administrator creating a filter it is also possible to do this in code. For simplicity we chose to simply add an expression to the WLS console, however creating a custom class to do the filtering might be somewhat more performant.
To remove the message above we simply created a log filter with the following expression:
MSGID != 'BEA-423498'
Once the filter is created you just need to apply it to the various loggers in the console. To do this simply click on each server in the console and go to Logging tab for the server. Open the Advanced section to apply the filter which was just created to the appropriate loggers. This process is a bit of a pain to do manually, fortunately it is easy to script this using WLST.
Posted by Gerald Nunn at 3:35 PM | Categories: WebLogic | Permalink
