1 2 Previous Next 20 Replies Latest reply on Dec 19, 2011 3:34 PM by suikast42 Go to original post
      • 15. Custom logger on AS 6

        Turns out, we already have a JIRA for that https://issues.jboss.org/browse/JBAS-8819

        • 16. Re: Custom logger on AS 6

          I used a custom appender with previous jboss which worked fine. The appender was added programmatically. In jboss 6 it stopped working. I debugged the code and the appender is added fine, but append() is never called like before. Still use log4j and the rest of the logging logs fine to the logg file even though the switch to jboss-logging.


          My code is below:


          The class:


             class LocalAppender extends AppenderSkeleton {


                LocalAppender() {

                   setLayout(new PatternLayout("%d %-5p [%c{1}] %m%n"));





                protected void append(LoggingEvent event) {

                   String formattedEvent = getLayout().format(event);

                   synchronized(eventBuffer) {





                public boolean requiresLayout() {

                   return true;



                public void close() {




          Instantiate the class and added to the root appender:


          LocalAppender appender = new LocalAppender();


          • 17. Re: Custom logger on AS 6

            So you are telling me I should upgrade to JBoss 6.1.0?

            • 18. Re: Custom logger on AS 6

              So you are telling me I should upgrade to JBoss 6.1.0?

              Its typically a good idea to update to the latest version, there is really not much to lose as 6.1 mostly brought component upgrades and fixes. See the complete list of changes here http://community.jboss.org/wiki/AS610FinalReleaseNotes.

              • 19. Re: Custom logger on AS 6

                Ok, i upgraded to JBOSS 6.1.0


                Added a log4j appender like so:


                   <log4j-appender name="BUFFER_APPENDER" class="za.co.quinn.BufferAppender">




                      <level name="INFO"/>


                         <pattern-formatter pattern="%d %-5p [%c{1}] %m%n"/>





                      <!-- Set the root logger priority via a system property, with a default value. -->

                      <level name="${jboss.server.log.threshold:INFO}"/>


                         <handler-ref name="CONSOLE"/>

                         <handler-ref name="FILE"/>

                                  <handler-ref name="BUFFER_APPENDER"/>




                Compiled and build a jar with my BufferAppender and added it to "jboss-6.1.0.Final/server/myinstance/lib"


                Started and debugged the BufferAppender and it works fine.


                GREAT PROBLEM SOLVED FOR JBOSS 6.0.0


                Now I deploy my application and try to access the BufferAppender like so:


                      ArrayList<String> result = new ArrayList<String>();


                      Logger logger = Logger.getLogger("BUFFER_APPENDER");

                      Enumeration enumeration = logger.getAllAppenders();

                      while (enumeration.hasMoreElements()) {

                         Appender appender = (Appender) enumeration.nextElement();

                         if ("BufferAppender".equals(appender.getName())) {

                            BufferAppender bufferAppender = (BufferAppender) appender;





                NO LUCK


                The Logger (BUFFER_APPENDER) is valid, but it contains no appenders (logger.getAllAppenders().hasMoreElements() = false).


                WHERE HAS MY BufferAppender GONE???

                • 20. Re: Custom logger on AS 6


                  The Logger (BUFFER_APPENDER) is valid, but it contains no appenders (logger.getAllAppenders().hasMoreElements() = false).


                  WHERE HAS MY BufferAppender GONE???

                  I can say where you Appender gone. If try use my Log4jAppender I see that I get a BirdgeAppender.




                  * A log4j logger which bridges to a LogManager logger.


                  public final class BridgeLogger extends org.apache.log4j.Logger {


                     private static final String FQCN = BridgeLogger.class.getName();


                     private final Logger logger;


                     public BridgeLogger(final Logger logger) {


                         this.logger = logger;



                     public void addAppender(final Appender newAppender) {

                         // ignored



                     public void callAppenders(final LoggingEvent event) {

                         // ignored for now (TODO?)



                  public Appender getAppender(final String name) {

                          // ignored

                          return null;



                  public void setAdditivity(final boolean additive) {

                          // ignored





                  I start a thread about the same issue. http://community.jboss.org/message/642287#642287


                  So let's pool forces .


                  I hope someone solved it

                  1 2 Previous Next