[jboss-dev-forums] [JBoss AS 7 Development] - Re: Logging with slf4j in 7.1.0.Final

Robert Smith do-not-reply at jboss.com
Thu Aug 30 10:47:04 EDT 2012


Robert Smith [https://community.jboss.org/people/rsmith1] created the discussion

"Re: Logging with slf4j in 7.1.0.Final"

To view the discussion, visit: https://community.jboss.org/message/757026#757026

--------------------------------------------------------------
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
[https://community.jboss.org/message/757026#757026]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120830/7a9cdf48/attachment.html 


More information about the jboss-dev-forums mailing list