On Sat, 3 May 2014, Sonderegger, Markus wrote:

I tried the above cspec.E but I am getting the following error
Argument "srp03443ax.juliusbaer.com" isn't numeric in sprintf at

That's quite odd, because the code below works for me with Log::Log4perl
1.42 without any warnings and generates this (expected) output:

:MINOR:myhostname:BCOM:AMH: ./t2 Blah

Seems like in your example, a hostname is being printed as a numerical string,
but I can’t see what this could be caused by based on the code you’ve
submitted. Maybe there’s something else going on?

    use strict;
    use warnings;
    use Log::Log4perl qw(:easy);

    my $conf = q(
    log4perl.category.Bar.Twix         = WARN, SYSLOG
    log4perl.appender.SYSLOG           = Log::Dispatch::Screen
    log4perl.appender.SYSLOG.Threshold = WARN
    log4perl.appender.SYSLOG.facility  = local2
    log4perl.appender.SYSLOG.ident     = 'tivoli'
    log4perl.appender.SYSLOG.layout    = Log::Log4perl::Layout::PatternLayout
    log4perl.appender.SYSLOG.layout.cspec.E = sub { return 'MINOR' if $_[3] eq 
'WARN' }
    
log4perl.appender.SYSLOG.layout.ConversionPattern=:%E:%H:%X{sx_Appl}:%X{sx_Inst}:
 %F %m%n

    log4perl.appender.Logfile.layout   = Log::Log4perl::Layout::PatternLayout
    log4perl.appender.Logfile.layout.cspec.E = sub { return $_[3] }

    log4perl.appender.Logfile.layout.ConversionPattern=:%E: %m%n
    );

    Log::Log4perl::init(\$conf);

    Log::Log4perl::MDC->put('sx_Appl', 'BCOM');
    Log::Log4perl::MDC->put('sx_Inst', 'AMH');

    my $logger = get_logger("Bar::Twix");
    $logger->warn("Blah”);


--
-- Mike

Mike Schilli
m...@perlmeister.com

The Tivoli log file adapter reads a file where its information is
delimited by colons:

severity, hostname, Application, Instance, Program, Message.

 

Using a pattern layout I can create this entry as in (actually SYSLOG is 
writing into Tivoli file)

 

log4perl.appender.SYSLOG           = Log::Dispatch::Syslog

log4perl.appender.SYSLOG.Threshold = WARN

log4perl.appender.SYSLOG.facility  = local2

log4perl.appender.SYSLOG.ident     = 'tivoli'

log4perl.appender.SYSLOG.layout    = Log::Log4perl::Layout::PatternLayout

log4perl.appender.SYSLOG.layout.cspec.E = sub { return 'MINOR' if $_[3] eq 
'WARN' }

log4perl.appender.SYSLOG.layout.ConversionPattern=:%E:%H:%X{sx_Appl}:%X{sx_Inst}:
 %F %m%n

 

but I am struggling with mapping Log4Perl severities to Tivoli severities.


/u01/app/perl/lib/perl5/site_perl/5.16.3/Log/Log4perl/Layout/PatternLayout.pm
line 307.

Missing argument in sprintf at 
/u01/app/perl/lib/perl5/site_perl/5.16.3/Log/Log4perl/Layout/PatternLayout.pm 
line 307.

 

when executig

#!/u01/app/perl/bin/perl

use warnings;

use strict;

use Log::Log4perl qw(get_logger);

 

Log::Log4perl::init( '/u01/app/amh/UserProvisioning/testing.conf' );

Log::Log4perl::MDC->put('sx_Appl', 'BCOM');

Log::Log4perl::MDC->put('sx_Inst', 'AMH');

my $logger = get_logger("");

$logger->warn("Testing");

 

 

Any help is greatly appreciated.

Regards

Markus

_____________________________________________________________

Dr. Markus Sonderegger

Application Integration

Bank Julius Baer & Co. Ltd.

Hohlstrasse 600, P.O. Box, CH-8010 Zurich, Switzerland

Telephone +41 58 88 77281, Telefax +41 58 88 74851

Mobile Phone +41 79 698 09 79

www.juliusbaer.com

 

Julius Baer cares about the environment: Please do not print this e-mail unless 
you really need to.

 



*****JuliusBaer Disclaimer***** This e-mail is for the intended recipient only 
and may contain confidential or privileged information. If you have received 
this
e-mail by mistake, please contact us immediately and completely delete it (and 
any attachments) and do not forward it or inform any other person of its 
contents.
If you send us messages by e-mail, we take this as your authorisation to 
correspond with you by e-mail, however, we reserve the right not to execute 
orders and
instructions transmitted by e-mail at any time and without further explanation. 
If you do not wish to receive any further e-mail correspondence please let us 
know.
E-mail transmission cannot be guaranteed to be secure or error-free as 
information could be intercepted, amended, corrupted, lost, destroyed, arrive 
late or
incomplete, or contain viruses. Neither the Julius Baer Group nor the sender 
accept liability for any errors or omissions in the content of this message 
which
arise as a result of its e-mail transmission. Please note that all e-mail 
communications to and from the Julius Baer Group may be monitored. This 
communication is
for informational purposes only. It is not intended as an offer or solicitation 
for the purchase or sale of any financial instrument or as an official 
confirmation
of any transaction.

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to