[jboss-as7-dev] Listen to all JBoss logging messages
Jaikiran Pai
jpai at redhat.com
Tue Aug 30 04:15:46 EDT 2011
James and/or David Lloyd would be able to confirm, but from what I know
of the JBoss Logging APIs, you should be using the
org.jboss.logmanager.Logger which has methods like addHandler available
on it. Notice that it's org.jboss.logmanager.Logger and not the usual
org.jboss.logging.Logger
P.S: Make sure you add a module dependency on org.jboss.logmanager module.
-Jaikiran
On Tuesday 30 August 2011 01:36 PM, David Bosschaert wrote:
> James, Jaikiran, thanks for the replies.
> Is there a way to add a custom handler programatically? I'm in a JUnit
> test (Arquillian) so I'd just like to just add it for the duration of my
> test.
>
> Thanks,
>
> David
>
> On 30/08/2011 06:50, Jaikiran Pai wrote:
>> On Tuesday 30 August 2011 03:21 AM, James Perkins wrote:
>>> As Brian points out you can use a custom handler. You can attach it to
>>> the root logger, but it will only log messages that meet the root-logger
>>> level.
>> Also note that, other than the "level" of the root-logger, the
>> "use-parent-handler" of each logger will play a part in whether the
>> message ultimately reaches the handler(s) configured for the
>> root-logger. If some logger sets the use-parent-handler to false, then
>> that message won't make it to your custom handler configured at the root
>> logger.
>>
>> Where do you want this feature by the way?
>>
>> -Jaikiran
>>> For example if you want to see all messages debug and higher in a
>>> separate file you could do something like this:
>>>
>>> <subsystem>
>>> ...
>>> <custom-handler name="debugFileHandler"
>>> class="org.jboss.logmanager.handlers.FileHandler"
>>> module="org.jboss.logmanager">
>>> <level name="DEBUG"/>
>>> <properties>
>>> <property name="file" value="/home/user/debug.log"/>
>>> <property name="autoFlush" value="true"/>
>>> </properties>
>>> </custom-handler>
>>> <root-logger>
>>> <level name="ALL"/>
>>> <handlers>
>>> <handler name="CONSOLE"/>
>>> <handler name="FILE"/>
>>> <handler name="debugFileHandler"/>
>>> </handlers>
>>> </root-logger>
>>> ...
>>> </subsystem>
>>>
>>> On 08/26/2011 04:05 AM, David Bosschaert wrote:
>>>> Hi all,
>>>>
>>>> For a test case I'm looking for a way to simply listen to all the log
>>>> messages sent through JBoss logging. Is there a way to do this?
>>>>
>>>> Thanks,
>>>>
>>>> David
>>>> _______________________________________________
>>>> jboss-as7-dev mailing list
>>>> jboss-as7-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>> _______________________________________________
>> jboss-as7-dev mailing list
>> jboss-as7-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
>
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
More information about the jboss-as7-dev
mailing list