logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Shelley <rshel...@csun.edu>
Subject Re: Receive the File & line number
Date Sun, 14 Jan 2007 18:21:13 GMT
Can't you use %L in the configuration file for the pattern?

ConversionPattern=(%F:%L)

Generates file name and line number separated by a colon...   
MyFile.java:1

http://logging.apache.org/log4j/docs/api/org/apache/log4j/ 
PatternLayout.html

It's not optimized, however.  I don't believe there's a simple,  
optimized, means of getting the line number from java (otherwise it  
probably would be used by Log4J inherently).

On Jan 14, 2007, at 1:50 AM, Feigin Yaron wrote:

> Hi all,
> Is there an optimized way via the log4j functions to receive the  
> line we
> are printing from without printing all stack and manipulating it?
> In C/C++ there is a __LINE__ macro that do the job...
> Is there an equivalent in java for that?
> Many thanks,
> Yaron Feigin
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message