-
1. Re: Not root logger log nothing
wdfink Oct 1, 2014 8:33 AM (in response to homich)No
If you don't attach any configuration or hint it will not possible
-
2. Re: Re: Not root logger log nothing
homich Oct 1, 2014 8:47 AM (in response to wdfink)so this is my logging profile configuration file log.csv is creating but stay empty
<logging-profile name="app">
<console-handler name="CONSOLE">
<level name="INFO"/>
<formatter>
<named-formatter name="COLOR-PATTERN"/>
</formatter>
</console-handler>
<periodic-rotating-file-handler name="FILE" autoflush="true">
<formatter>
<named-formatter name="PATTERN"/>
</formatter>
<file relative-to="jboss.server.log.dir" path="log.csv"/>
<suffix value=".yyyy-MM-dd-H"/>
<append value="true"/>
</periodic-rotating-file-handler>
<logger category="com.mypackage.MyClass">
<level name="DEBUG"/>
<handlers>
<handler name="FILE"/>
</handlers>
</logger>
<root-logger>
<level name="INFO"/>
<handlers>
<handler name="CONSOLE"/>
</handlers>
</root-logger>
<formatter name="COLOR-PATTERN">
<pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>
</formatter>
-
3. Re: Not root logger log nothing
darrenjones Oct 1, 2014 10:36 AM (in response to homich)Are you expecting DEBUG messages from com.mypackage.MyClass to appear in the console output?
If so, then the console-handler, which is set to INFO in your config, needs also to be set to DEBUG:
<console-handler name="CONSOLE">
<level name="DEBUG"/>
-
4. Re: Not root logger log nothing
homich Oct 1, 2014 10:51 AM (in response to darrenjones)no, i want that log messages from com.mypackage.MyClass will be written in FILE, because i assign that class to handler in
<logger category="com.mypackage.MyClass">
<level name="DEBUG"/>
<handlers>
<handler name="FILE"/>
</handlers>
</logger>
but in fact i have an empty file FILE and no messages inside it
-
5. Re: Not root logger log nothing
darrenjones Oct 1, 2014 11:52 AM (in response to homich)I wonder if the lack of <level> in the file handler is the problem - perhaps it is defaulting to INFO.
I had success by adding:
<periodic-rotating-file-handler name="FILE" autoflush="true">
<level name="DEBUG"/>
-
6. Re: Re: Not root logger log nothing
jamezp Oct 1, 2014 6:15 PM (in response to homich)Did you set the Logging-Profile: entry in your MANIFEST.MF to app?
FWIW it doesn't look like you need to use a logging-profile, unless of course you want to or plan to make app specific changes down the road. If you don't want to use a profile you just need to create a new file handler and your logger with use-parent-handlers set to false.
Here's an example CLI script to configure the logging subsystem
batch /subsystem=logging/periodic-rotating-file-handler=app-file:add(append=true,autoflush=true,named-formatter=PATTERN,suffix=".yyyy-MM-dd",file={relative-to="jboss.server.log.dir", path="app.log"}) /subsystem=logging/logger=com.mypackage.MyClass:add(use-parent-handlers=false,level=DEBUG,handlers=["app-file"]) run-batch
You can then run the command with CLI like
./bin/jboss-cli.sh -c --file=/path/to/file.cli
---
James R. Perkins
-
7. Re: Re: Not root logger log nothing
homich Oct 2, 2014 2:53 AM (in response to jamezp)of course i set the Logging-Profile in my Manifest.
By my idea i want to separate logging profiles in defferent apps of my server.
Finally i found bug in Wildfly jira from february 2014 exactly like my question and it is still unresolved and open. So i have to move all my settings from profiles to root logger and it works great.
I am very sad that functionality of logger not completed yet.
Thanks everyone for help.
-
8. Re: Re: Not root logger log nothing
jamezp Oct 2, 2014 11:23 AM (in response to homich)What's the JIRA? I don't see any logging JIRA's related to logging profiles. Only one using a log4j ConsoleAppender in a per-deployment logging.
--
James R. Perkins