8 Replies Latest reply on Oct 2, 2014 11:23 AM by jamezp

    Not root logger log nothing

    homich

      Good day to everyone,

      I write to my standalone.xml logging profiles for defferent applications. There is simple loggers and root logger. But only root logger write information to files. Does anybody know why and what to do?

        • 1. Re: Not root logger log nothing
          wdfink

          No

           

          If you don't attach any configuration or hint it will not possible

          • 2. Re: Re: Not root logger log nothing
            homich

            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

              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

                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

                  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

                    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

                      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

                        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