itemprop = "text">
There are some audits in my application, each audit event has its own log4j class with the name that is by the same string The prefix is
Example: General Auditing Category Name: com.company.audit
Web Login Category Name: com.www.audit.web.login
Create something: com.company Audit.api.create etc. ..
Some categories should be logged by default, but nothing =>
& lt; Category name = "com.compamy.audit" additivity = "true" & gt; & Lt; Priority value = "INFO" /> & Lt; / Category & gt;
& lt; Category name = "com.company.audit.web.login" additivity = "true" & gt; & Lt; Priority value = "DEBUG" /> & Lt; / Category & gt;
The INFO Second Class must not be logged by default. At least I thought that but it does not work. How to help to override logging level on 'sub-category'
Note: I do not have much chance of completely changing a naming scheme
Added: < / P>
Here is the configuration for the appender:
& lt; Episode class = "org.apache.log4j.RollingFileAppender" name = "Company_AUDIT" & gt;
& paramount = "file" value = "$ {jboss.server.log} Dir} /company_audit.log" />
& lt; Param value = "10000KB" name = "maxfile size" />
& lt; Param value = "10" name = "maxbackupindex" />
& lt; Layout class = "org.apache.log4j.PatternLayout"> & lt; Param name = "ConversionPattern" value = "foo" /> & lt; / Layout>
& lt; / Appender>
Your configuration means: Category Audit for com.company
, log all messages at the level INFO
or more. For com.company.audit.web.login
, log all messages at the level DEBUG
or more. So all messages in the second category are logged, which is what you have asked.
What you really want to choose is whether or not the second category is displayed. I can think of two ways to do this:
-
In your code, use this conference that all messages of
com.company.audit INFO
, andcom.company.audit.web.login
will be logged in to all message levelDEBUG
. You only need to set the main category level in your configuration:-
debug
: display all messages -
information
: Do not display "Optional" messages (sub-categories) -
In the configuration, enter
com.company.audit.web .login
leveloff
when you want to disable your messages when you want to activate it, just comment on the line (this is the main heir of the configuration from the main category Will happen).
-
I am the second option because you can use the level of gravity for the message (this is basically for).
Comments
Post a Comment