Avi
Contributor
Contributor

Log Levels – LOG4J Jboss log files

We have a JBoss based system that we intend to monitor with Hyperic.

When setting alerts on log files entries we discovered that the available log levels don’t include the ‘TRACE’ level.
Unfortunately for us some error messages are logged from this system using the TRACE level (not a very good practice but that is the way this system was implemented).

Looking at HQ source code I found that ‘Log4JLogTrackPlugin’ class defines log levels as follows:

private static final String[] LOG_LEVELS = {
"FATAL,ERROR", //Error
"WARN", //Warning
"INFO", //Info
"DEBUG" //Debug
};

public String[] getLogLevelAliases() {
return LOG_LEVELS;
}

What would be the quickest way to enable us including log events with ‘TRACE’ level? (Edit the above, build and use the modified jar?)

Any suggestions will be greatly appreciated.
0 Kudos
5 Replies
Matt5D
Enthusiast
Enthusiast

Probably, or redirect your log4j appenders to a target that can be parsed out of the box. Note adding a 5th element to that array looks like it will get you an illegalargumentexception from the superclass. Do it as "DEBUG, TRACE" the same way fatal and error are grouped together.
Avi
Contributor
Contributor

Thanks for the reply.
I changed my source (as suggested) built and deployed the hq-product.jar to the corresponding agent and it worked.
I assume this can be raised as a defect, so new versions of HQ will be able to alert on TRACE output.

Cheers,

Avi
0 Kudos
BradFelmey
Hot Shot
Hot Shot

http://jira.hyperic.com

File a ticket, por favor.
0 Kudos
dougm_hyperic
VMware Employee
VMware Employee

Hmm, I was about to check in a fix to include the TRACE level as debug.. but if there happens to be anyone currently monitoring at DEBUG they may start getting flooded with otherwise unwanted TRACE messages. I think that may have been why TRACE was left out in the first place, normally just used for developer/debugging, not so much for release? The plugin just uses a substring to filter based on the level, so if you could just get the string DEBUG into all the trace messages you'd be set 😉 We could also have a plugin property or agent.properties for this, just not sure about flipping it on by default. Open to suggestions here.
0 Kudos
Matt5D
Enthusiast
Enthusiast

I'd vote for plugin property, then a user can map the l4j levels to the 4 levels recognized by hyperic in any way they choose. e.g., for a development/demo/beta type of instance you may want it to look like:

String[] LOG_LEVELS = {
"FATAL,ERROR", //Error
"WARN,INFO", //Warning
"DEBUG", //Info
"TRACE" //Debug
};
0 Kudos