JBoss Community

Re: Logging with slf4j in 7.1.0.Final

created by Robert Smith in JBoss AS 7 Development - View the full discussion

Thanks for the response David. We are kind of stuck until an open source version that allows application logging is available.
We have since went forward and are using the standalone.xml configuration.

 

We've run into what I believe is a limitation. We have a couple of applications that both share a common jar file. It would be useful for us to be able to direct the logging output to the appropriate application.

 

I've not been able to determine how to do it using handlers and categories.

 

I've create 2 size-rotating-file-handlers, one for each application.

For the categories that are specific to the each application, Ive created a category that directs to the appropriate handler.

 

Since each application includes the jar file, there doesnt appear to be a way to direct the common jars log output based on the application it is being called from.

 

Example:

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

                <level name="INFO"/>

                <formatter>

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

                </formatter>

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

                <rotate-size value="100K"/>

                <append value="false"/>

            </size-rotating-file-handler>

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

                <level name="INFO"/>

                <formatter>

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

                </formatter>

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

                <rotate-size value="100K"/>

                <append value="false"/>

            </size-rotating-file-handler>

 

            <logger category="app1.package" use-parent-handlers="false">

                <handlers>

                    <handler name="app1"/>

                </handlers>

            </logger>

            <logger category="app2.package" use-parent-handlers="false">

                <handlers>

                    <handler name="app2"/>

                </handlers>

            </logger>

            <logger category="common" use-parent-handlers="false">

                <handlers>

                    ?????

                </handlers>

            </logger>

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community