Hi

Please add a method String getThreadNumber() to the class
org.apache.log4j.spi.LoggingEvent which
returns the thread number only, i.e. without the (pretty much redundant) text
"Thread-" in front.

I am aware that this is some awkward reverse engineering. It would be better if
the thread implementation itself in the Java library would provide such a
function - is anybody aware of a change request to Sun about that?

Here's a code snippet that would do this:

  public
  String getThreadNumber() {
    if(threadNumber == null) {
                String s = (Thread.currentThread()).getName();
                if ("main".compareTo(s) == 0)
                        threadNumber = "m";
                else
                        threadNumber = s.substring(7);
    }
    return threadNumber;
  }


-Bernd.


-- 
Bernd Goetz                                     [EMAIL PROTECTED]
TARSEC AG                                       Tel +41 1 496 61 11
Rautistrasse 12                                 Fax +41 1 496 61 99
Postfach                                        Mobile +41 79 759 04 26
8047 Zurich, Switzerland                        http://www.tarsec.com
--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to