From: Harrington, P. <Pau...@de...> - 2002-11-07 16:02:28
|
Here is the full patch .... put in the extra (but not necessary?) step of assigning to $result just to highlight it. I don't know how you guys feel about 'feeping creaturism' with tokens but we would also like a token, say %h or %H, for the hostname ... we use are using a centralized file for our logs so would like the hostname too. pjjH --- PatternLayout.pm Mon Oct 7 17:41:50 2002 +++ /proj/finop/local_boffice/lib/perl5/site_perl/5.6.1/Log/Log4perl/Layout/Patt ernLayout.pm Wed Nov 6 14:47:25 2002 @@ -90,7 +90,7 @@ # Parse the format $format =~ s/%(-*\d*) - ([cCdfFILmMnprtxX%]) + ([cCdfFILmMnpPrtxX%]) (?:{(.*?)})*/ rep($self, $1, $2, $3); /gex; @@ -171,6 +171,7 @@ $info{d} = 1; # Dummy value, corrected later $info{n} = "\n"; $info{p} = $priority; + $info{P} = $$; if($self->{info_needed}->{r}) { if($TIME_HIRES_AVAILABLE) { @@ -201,6 +202,9 @@ # just for %d if($op eq 'd') { $result = $info{$op}->format(current_time()); + } + if($op eq 'P') { + $result = $$; } } push @results, $result; -----Original Message----- From: msc...@ao... [mailto:msc...@ao...] Sent: Thursday, November 07, 2002 5:49 AM To: Harrington, Paul; log...@li... Subject: Re: [log4perl-devel] Could we have a token in PatternLayout for pid In a message dated 11/6/2002 6:26:36 PM Eastern Standard Time, Pau...@de... writes: >we hacked in support today for a %P token so that we can include process ids >in the log messages without mucking around with the application-level log >messages. Accepted and checked in -- it's going to be part of 0.26, thanks! -- -- Mike ############################ # Mike Schilli # # log...@pe... # # http://perlmeister.com # # log4perl.sourceforge.net # ############################ |
From: Aaron S. C. <as...@vi...> - 2002-11-07 16:12:55
|
FWIW, I would cast a vote for /H/i too. This, and 'P', were both widgets that we included in our own home-brewed log thingy. On Thu, 7 Nov 2002, Harrington, Paul wrote: > Here is the full patch .... put in the extra (but not necessary?) step of > assigning to $result just to highlight it. > > I don't know how you guys feel about 'feeping creaturism' with tokens but we > would also like a token, say %h or %H, for the hostname ... we use are using > a centralized file for our logs so would like the hostname too. |
From: Kevin G. <ke...@go...> - 2002-11-07 17:37:46
Attachments:
fspec.diff
031UsrFspec.t
|
One of the java projects I used log4j in really wanted a pid too, boy was that a hassle. I agree, let's putin %P and %H. And even better, check this out, how about user-assigned format specifiers at runtime in the config file? (The diff doesn't work as a patch, dunno why, but you can apply the .rej by hand) Aaron Straup Cope wrote: > FWIW, I would cast a vote for /H/i too. > > This, and 'P', were both widgets that we included in our own home-brewed > log thingy. > > On Thu, 7 Nov 2002, Harrington, Paul wrote: > > >>Here is the full patch .... put in the extra (but not necessary?) step of >>assigning to $result just to highlight it. >> >>I don't know how you guys feel about 'feeping creaturism' with tokens but we >>would also like a token, say %h or %H, for the hostname ... we use are using >>a centralized file for our logs so would like the hostname too. > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: See the NEW Palm > Tungsten T handheld. Power & Color in a compact size! > http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Mike S. <msc...@ao...> - 2002-11-08 02:40:35
|
ke...@go... wrote: > One of the java projects I used log4j in really wanted a pid too, boy > was that a hassle. I agree, let's putin %P and %H. > > And even better, check this out, how about user-assigned format > specifiers at runtime in the config file? (The diff doesn't work as a > patch, dunno why, but you can apply the .rej by hand) Way cool! It deviates from the log4j spec, but it's a handy feature. Question is if we should put it into PatternLayout.pm or create a subclass? Regarding %P and %H, I'll go ahead and submit those to the log4j guys, maybe they'll like it, too. -- -- Mike Mike Schilli log...@pe... |
From: Kevin G. <ke...@go...> - 2002-11-08 16:46:03
|
> Regarding %P and %H, I'll go ahead and submit those to the log4j guys, > maybe they'll like it, too. I wouldn't count on it. Remember, Java in its quest to be "platform independent" won't implement anything it can't do universally. There is no built-in way to get a pid from inside the JVM, I had to write JNI code to do it. I'll bet the same is true for hostname, even the perl module resorts to hackery Sys::Hostname - Try every conceivable way to get hostname and croaks if nothing works. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Kevin G. <ke...@go...> - 2002-11-08 17:34:14
|
>> And even better, check this out, how about user-assigned format >> specifiers at runtime in the config file? (The diff doesn't work as a >> patch, dunno why, but you can apply the .rej by hand) > > Way cool! It deviates from the log4j spec, but it's a handy feature. > Question is if we should put it into PatternLayout.pm or create a subclass? I don't know. If we're deviating from their spec it seems like we should subclass it. On the other hand, it's pretty obvious from the perl code in the config file that there's perl-specific stuff going on, and subclassing would hurt performance. I'd say, if we're already breaking compatibility with %P and %H, this isn't any worse than that. What do you think? Once I feel a consensus I need to add error checking, unit tests, and maybe some documentation. -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |
From: Mike S. <msc...@ao...> - 2002-11-07 20:05:16
|
Pau...@de... wrote: >Here is the full patch .... put in the extra (but not necessary?) step of >assigning to $result just to highlight it. > Thanks, that's exactly how I checked it into CVS last night -- with the exception of the last snippet (in the foreach loop over stack entries), I don't think that's needed. Or is it? -- -- Mike Mike Schilli log...@pe... |