[JBoss-dev] CVS update: jboss/src/main/org/jboss/logging/log4j CategoryStream.java CategoryWriter.java package.html
User: user57 Date: 02/02/24 02:16:53 Removed: src/main/org/jboss/logging/log4j CategoryStream.java CategoryWriter.java package.html Log: o moved non-service logging components to common o moved Cat* to org.jboss.logging.util o renamed TracePriority to XPriority as this class provides the ability to hold other extention priorites. ___ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/logging/log4j CategoryStream.java
User: user57 Date: 01/07/06 17:49:34 Modified:src/main/org/jboss/logging/log4j CategoryStream.java Log: o write() will not log messages that are empty. something is logging exceptions (including blank lines), but I can't find out what is doing it, so for now just don't log stuff with empty messages. Revision ChangesPath 1.5 +41 -24jboss/src/main/org/jboss/logging/log4j/CategoryStream.java Index: CategoryStream.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/CategoryStream.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- CategoryStream.java 2001/06/18 20:01:27 1.4 +++ CategoryStream.java 2001/07/07 00:49:34 1.5 @@ -12,35 +12,46 @@ import org.apache.log4j.Category; import org.apache.log4j.Priority; -/** A subclass of PrintStream that redirects its output to a log4j Category. -This class is used to map PrintStream/PrintWriter oriented logging onto -the log4j Categories. Examples include capturing System.out/System.err writes. - -@author a href=mailto:[EMAIL PROTECTED];Scott Stark/a. -@version $Revision: 1.4 $ -*/ -public class CategoryStream extends PrintStream +/** + * A subclass of PrintStream that redirects its output to a log4j Category. + * + * pThis class is used to map PrintStream/PrintWriter oriented logging onto + *the log4j Categories. Examples include capturing System.out/System.err + *writes. + * + * + * @author a href=mailto:[EMAIL PROTECTED];Scott Stark/a. + * @version $Revision: 1.5 $ + */ +public class CategoryStream +extends PrintStream { private Category category; private Priority priority; private boolean inWrite; private boolean issuedWarning; -/** Redirect logging to the indicated category using Priority.INFO -*/ -public CategoryStream(Category category) +/** + * Redirect logging to the indicated category using Priority.INFO + */ +public CategoryStream(final Category category) { this(category, Priority.INFO, System.out); } -/** Redirect logging to the indicated category using the given -priority. The ps is simply passed to super but is not used. -*/ -public CategoryStream(Category category, Priority priority, PrintStream ps) + +/** + * Redirect logging to the indicated category using the given + * priority. The ps is simply passed to super but is not used. + */ +public CategoryStream(final Category category, + final Priority priority, + final PrintStream ps) { super(ps); this.category = category; this.priority = priority; } + public void println(String msg) { if( msg == null ) @@ -48,6 +59,7 @@ byte[] bytes = msg.getBytes(); write(bytes, 0, bytes.length); } + public void println(Object msg) { if( msg == null ) @@ -55,40 +67,45 @@ byte[] bytes = msg.toString().getBytes(); write(bytes, 0, bytes.length); } + public void write(byte b) { byte[] bytes = {b}; write(bytes, 0, 1); } + public synchronized void write(byte[] b, int off, int len) { if( inWrite == true ) { -/* There is a configuration error that is causing looping. Most - likely there are two console appenders so just return to prevent - spinning. -*/ +// There is a configuration error that is causing looping. Most +// likely there are two console appenders so just return to prevent +// spinning. if( issuedWarning == false ) { String msg = ERROR: invalid console appender config detected, console stream is looping; try { out.write(msg.getBytes()); -} -catch(IOException e) -{ } +catch(IOException ignore) {} issuedWarning = true; } return; } inWrite = true; + // Remove the end of line chars while( len 0 (b[len-1] == '\n' || b[len-1] == '\r') len off ) len --; -String msg = new String(b, off, len); -category.log(priority, msg); +// HACK, something is logging exceptions line by line (including +// blanks), but I can't seem to find it, so for now just ignore +// empty lines... they aren't very useful. +if (len != 0) {
[JBoss-dev] CVS update: jboss/src/main/org/jboss/logging/log4j CategoryStream.java ConsoleAppender.java
User: mnf999 Date: 01/06/18 13:01:27 Modified:src/main/org/jboss/logging/log4j CategoryStream.java ConsoleAppender.java Log: Updating the new names and author tags to reflect the new coding guidelines Revision ChangesPath 1.4 +2 -2 jboss/src/main/org/jboss/logging/log4j/CategoryStream.java Index: CategoryStream.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/CategoryStream.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- CategoryStream.java 2001/06/15 21:54:20 1.3 +++ CategoryStream.java 2001/06/18 20:01:27 1.4 @@ -16,8 +16,8 @@ This class is used to map PrintStream/PrintWriter oriented logging onto the log4j Categories. Examples include capturing System.out/System.err writes. -@author [EMAIL PROTECTED] -@version $Revision: 1.3 $ +@author a href=mailto:[EMAIL PROTECTED];Scott Stark/a. +@version $Revision: 1.4 $ */ public class CategoryStream extends PrintStream { 1.3 +2 -2 jboss/src/main/org/jboss/logging/log4j/ConsoleAppender.java Index: ConsoleAppender.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/ConsoleAppender.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ConsoleAppender.java 2001/06/15 21:54:20 1.2 +++ ConsoleAppender.java 2001/06/18 20:01:27 1.3 @@ -18,8 +18,8 @@ and System.err to route logging through those objects to the log4j system via a category named Default. -@author [EMAIL PROTECTED] -@version $Revision: 1.2 $ +@author a href=mailto:[EMAIL PROTECTED];Scott Stark/a. +@version $Revision: 1.3 $ */ public class ConsoleAppender extends AppenderSkeleton { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/logging/log4j CategoryStream.java ConsoleAppender.java
User: starksm Date: 01/06/15 14:54:20 Modified:src/main/org/jboss/logging/log4j CategoryStream.java ConsoleAppender.java Log: Add check to prevent invalid console appender configurations from creating infinite looping. Add NDC.push()/NDC.pop() usage in the Log setLog()/unsetLog() methods Revision ChangesPath 1.3 +40 -4 jboss/src/main/org/jboss/logging/log4j/CategoryStream.java Index: CategoryStream.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/CategoryStream.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CategoryStream.java 2001/05/22 22:12:57 1.2 +++ CategoryStream.java 2001/06/15 21:54:20 1.3 @@ -6,6 +6,7 @@ */ package org.jboss.logging.log4j; +import java.io.IOException; import java.io.PrintStream; import org.apache.log4j.Category; @@ -16,12 +17,14 @@ the log4j Categories. Examples include capturing System.out/System.err writes. @author [EMAIL PROTECTED] -@version $Revision: 1.2 $ +@version $Revision: 1.3 $ */ public class CategoryStream extends PrintStream { private Category category; private Priority priority; +private boolean inWrite; +private boolean issuedWarning; /** Redirect logging to the indicated category using Priority.INFO */ @@ -40,19 +43,52 @@ } public void println(String msg) { -category.log(priority, msg); +if( msg == null ) +msg = null; +byte[] bytes = msg.getBytes(); +write(bytes, 0, bytes.length); } public void println(Object msg) { -category.log(priority, msg); +if( msg == null ) +msg = null; +byte[] bytes = msg.toString().getBytes(); +write(bytes, 0, bytes.length); +} +public void write(byte b) +{ +byte[] bytes = {b}; +write(bytes, 0, 1); } -public void write(byte[] b, int off, int len) +public synchronized void write(byte[] b, int off, int len) { +if( inWrite == true ) +{ +/* There is a configuration error that is causing looping. Most + likely there are two console appenders so just return to prevent + spinning. +*/ +if( issuedWarning == false ) +{ +String msg = ERROR: invalid console appender config detected, console stream is looping; +try +{ +out.write(msg.getBytes()); +} +catch(IOException e) +{ +} +issuedWarning = true; +} +return; +} +inWrite = true; // Remove the end of line chars while( len 0 (b[len-1] == '\n' || b[len-1] == '\r') len off ) len --; String msg = new String(b, off, len); category.log(priority, msg); +inWrite = false; } } 1.2 +2 -2 jboss/src/main/org/jboss/logging/log4j/ConsoleAppender.java Index: ConsoleAppender.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/ConsoleAppender.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- ConsoleAppender.java 2001/05/11 02:50:29 1.1 +++ ConsoleAppender.java 2001/06/15 21:54:20 1.2 @@ -19,7 +19,7 @@ system via a category named Default. @author [EMAIL PROTECTED] -@version $Revision: 1.1 $ +@version $Revision: 1.2 $ */ public class ConsoleAppender extends AppenderSkeleton { @@ -61,8 +61,8 @@ { String msg = this.layout.format(event); if( event.priority == Priority.ERROR ) -out.print(msg); -else err.print(msg); +else +out.print(msg); } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jboss/src/main/org/jboss/logging/log4j CategoryStream.java
User: azakkerman Date: 01/05/22 15:12:57 Modified:src/main/org/jboss/logging/log4j CategoryStream.java Log: Initial commit of Tyrex distributed transaction manager support in JBoss. Support added for using JBoss with any TM that supports javax.transaction.TransactionManager interface. Revision ChangesPath 1.2 +3 -2 jboss/src/main/org/jboss/logging/log4j/CategoryStream.java Index: CategoryStream.java === RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/logging/log4j/CategoryStream.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CategoryStream.java 2001/05/11 02:50:29 1.1 +++ CategoryStream.java 2001/05/22 22:12:57 1.2 @@ -16,7 +16,7 @@ the log4j Categories. Examples include capturing System.out/System.err writes. @author [EMAIL PROTECTED] -@version $Revision: 1.1 $ +@version $Revision: 1.2 $ */ public class CategoryStream extends PrintStream { @@ -49,8 +49,9 @@ public void write(byte[] b, int off, int len) { // Remove the end of line chars -while( (b[len-1] == '\n' || b[len-1] == '\r') len off ) +while( len 0 (b[len-1] == '\n' || b[len-1] == '\r') len off ) len --; + String msg = new String(b, off, len); category.log(priority, msg); } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development