5 Replies Latest reply on Apr 25, 2016 2:42 PM by jamezp

    Log files wildfly-stdout and wildfly-stderr

    greenorchid

      Hi everybody,

       

      in my development environment I didn't see the log files that start with wildfly-stdout or wildfly-stderr, e.g. wildfly-stdout.2016-04-14 or wildfly-stderr.2016-04-14. But now I recognized that on my live system there exist those types of files. Wildfly creates them at the folder ...\wildfly\standalone\log. I use log4j as logger and added the log4j configurations at the standalone.xml. Now the content seems to be logged on live system twice, once at the wildfly-stdout/wildfly-stderr files and once at my own log4j log files.

       

      What can I do that only my log4j log files are used for logging and no files like wildfly-stdout and wildfly-stderr will be created?

       

      Thanks in advance!

        • 1. Re: Log files wildfly-stdout and wildfly-stderr
          jamezp

          How are you starting WildFly on the server? My guess is those are files where stdout and stderr are being piped from a processing. By default WildFly has a console-handler assigned to the root-logger. If you don't need to see the logs on a console, you can remove the handler from the root-logger.

           

          Can you explain how you're using log4j? I'm not sure how or why logs should be showing up twice.

           

          Are you looking to configure all of WildFly's logging with log4j or only your application?

           

          --

          James R. Perkins

          • 2. Re: Log files wildfly-stdout and wildfly-stderr
            greenorchid

            Hi James,

             

            thanx for your quick reply.

             

            I use wildfly on a Windows server. A Windows service starts the standalone.bat.

             

            The logging at the development environment works well how it's configured at the moment. The only problem ist the logging on a live system where I will avoid logging into other log files than into those that I  configure at the standalone.xml. Here is the part of the standalone.xml that configures my whole logging:

             

            <subsystem xmlns="urn:jboss:domain:logging:2.0">

                        <console-handler name="CONSOLE">

                            <level name="INFO"/>

                            <formatter>

                                <named-formatter name="MY-PATTERN"/>

                            </formatter>

                        </console-handler>

                        <custom-handler name="DB_LOGDETAIL_LOG4J_HANDLER" class="com.company.logDetailsLogging.JdbcLogger" module="com.company.logging">

                            <level name="INFO"/>

                            <formatter>

                                <pattern-formatter pattern="MY-PATTERN"/>

                            </formatter>

                            <properties>

                                <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>

                                <property name="jdbcUrl" value="jdbc:sqlserver://localhost\\SQLEXPRESS:1433;databaseName=PRODUCTIVE;"/>

                                <property name="username" value="XXXXXXX"/>

                                <property name="password" value="XXXXXXX"/>

                            </properties>

                        </custom-handler>

                        <size-rotating-file-handler name="FILE" autoflush="true">

                            <formatter>

                                <named-formatter name="MY-PATTERN"/>

                            </formatter>

                            <file relative-to="jboss.server.log.dir" path="server.log"/>

                            <rotate-size value="50M"/>

                            <max-backup-index value="10"/>

                            <append value="true"/>

                        </size-rotating-file-handler>

                        <size-rotating-file-handler name="WORKER">

                            <formatter>

                                <named-formatter name="MY-PATTERN"/>

                            </formatter>

                            <file relative-to="jboss.server.log.dir" path="worker.log"/>

                            <rotate-size value="50M"/>

                            <max-backup-index value="10"/>

                            <append value="true"/>

                        </size-rotating-file-handler>

                        <size-rotating-file-handler name="SCHEDULER">

                            <formatter>

                                <named-formatter name="MY-PATTERN"/>

                            </formatter>

                            <file relative-to="jboss.server.log.dir" path="scheduler.log"/>

                            <rotate-size value="50M"/>

                            <max-backup-index value="10"/>

                            <append value="true"/>

                        </size-rotating-file-handler>

                        <size-rotating-file-handler name="HIBERNATE">

                            <formatter>

                                <named-formatter name="MY-PATTERN"/>

                            </formatter>

                            <file relative-to="jboss.server.log.dir" path="hibernate.log"/>

                            <rotate-size value="50M"/>

                            <max-backup-index value="10"/>

                            <append value="true"/>

                        </size-rotating-file-handler>

                        <logger category="com.arjuna">

                            <level name="WARN"/>

                        </logger>

                        <logger category="org.apache.tomcat.util.modeler">

                            <level name="WARN"/>

                        </logger>

                        <logger category="org.jboss.as.config">

                            <level name="DEBUG"/>

                        </logger>

                        <logger category="sun.rmi">

                            <level name="WARN"/>

                        </logger>

                        <logger category="jacorb">

                            <level name="WARN"/>

                        </logger>

                        <logger category="jacorb.config">

                            <level name="ERROR"/>

                        </logger>

                        <logger category="com.company" use-parent-handlers="false">

                            <level name="INFO"/>

                            <handlers>

                                <handler name="CONSOLE"/>

                                <handler name="WORKER"/>

                                <handler name="DB_LOGDETAIL_LOG4J_HANDLER"/>

                            </handlers>

                        </logger>

                        <logger category="com.company.scheduler" use-parent-handlers="false">

                            <level name="DEBUG"/>

                            <handlers>

                                <handler name="CONSOLE"/>

                                <handler name="SCHEDULER"/>

                            </handlers>

                        </logger>

                        <logger category="org.hibernate" use-parent-handlers="false">

                            <level name="INFO"/>

                            <handlers>

                                <handler name="CONSOLE"/>

                                <handler name="HIBERNATE"/>

                            </handlers>

                        </logger>

                        <logger category="org.hibernate.id" use-parent-handlers="false">

                            <level name="ERROR"/>

                            <handlers>

                                <handler name="CONSOLE"/>

                                <handler name="HIBERNATE"/>

                            </handlers>

                        </logger>

                        <root-logger>

                            <level name="INFO"/>

                            <handlers>

                                <handler name="CONSOLE"/>

                                <handler name="FILE"/>

                            </handlers>

                        </root-logger>

                        <formatter name="PATTERN">

                            <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

                        </formatter>

                        <formatter name="COLOR-PATTERN">

                            <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

                        </formatter>

                        <formatter name="MY-PATTERN">

                            <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n"/>

                        </formatter>

                    </subsystem>

            • 3. Re: Log files wildfly-stdout and wildfly-stderr
              jamezp

              Hi Andrea,

              Okay the wildfly-stdout and wildfly-stderr files are probably coming from the Windows process. If you don't want those files created you'd need to remove the CONSOLE handler on all the loggers that use it. I don't know how Windows services work, but those files might be created regardless of whether the console handler is removed. That said if you do remove the console handler then the files should be empty. The script that references them is here https://github.com/wildfly/wildfly-core/blob/master/core-feature-pack/src/main/resources/content/docs/contrib/scripts/service/service.bat.

               

              The following commands will remove the CONSOLE handler from each logger which won't require you to restart the service.

              /subsystem=logging/logger=com.company:remove-handler(name=CONSOLE)
              /subsystem=logging/logger=com.company.scheduler:remove-handler(name=CONSOLE)
              /subsystem=logging/logger=org.hibernate:remove-handler(name=CONSOLE)
              /subsystem=logging/logger=org.hibernate.id:remove-handler(name=CONSOLE)
              /subsystem=logging/root-logger=ROOT:remove-handler(name=CONSOLE)
              

               

              --

              James R. Perkins

              • 4. Re: Log files wildfly-stdout and wildfly-stderr
                greenorchid

                Hi James,

                 

                I tested the last days your suggestion with removing the CONSOLE handler. That works very well, the files were created but they are still empty. Only a restart of the wildfly creates additionally those files, if it's a new day with a new date.

                I would prefer the solution with your commands from above (so that I don't have to modify the standalone.xml) but I don't know where I have to add them. To the service.bat? Or do I have to make the calls at the commandline?

                • 5. Re: Log files wildfly-stdout and wildfly-stderr
                  jamezp

                  You'd probably have to modify the service.bat or maybe even create a new service exe (I'm not sure how these work to be honest). Maybe setting %STDOUT% and %STDERR% environment variables to NUL would work too.

                   

                  --

                  James R. Perkins