|
From: Kevin G. <ke...@go...> - 2002-11-01 17:25:17
|
Manuel, you didn't say what you have in your syslog.conf, but I'll bet=20
it's something like the relevant line from mine:
*.info;mail.none;authpriv.none;cron.none \
/var/log/messages
which catches all messages of level info or higher.
The log4perl api is designed to be a single point of control for=20
enabling/disabling logging messages, the decision whether to log or not=20
to log is taken at the log4perl level before the message gets passed on=20
to whatever is implementing the appender, in this case=20
Log::Dispatch::Syslog. We didn't want to have *two* points of control,=20
so all the messages that come out of log4perl are of level 'DEBUG', so=20
your syslog is seeing a DEBUG message, but it's set up to only include=20
INFO messages. So if you add this line to your syslog.conf
local1.debug /var/log/messages
and take the min_level setting out of your log4perl.conf, and give your=20
syslogd a hup then you should see results.
Note that I had to set the socket to 'unix' to get results on my=20
machine, but that depends on your setup.
Manuel de Vega Barreiro wrote:
> I have problem configuring syslog appender (Log-Dispatch-2.01) to work=20
> with Log4Perl(Log-Log4perl-0.25).
>=20
> I use these script and config file:
> script
> ------------------------------------------------
> #! /usr/local/bin/perl
> use strict;
>=20
> use Log::Log4perl qw(get_logger :levels);
> Log::Log4perl::init('log4perl.conf');
>=20
>=20
> my $logger =3D get_logger("");
>=20
>=20
> $logger->level($INFO);
> print "Ahora con nivel ERROR\n";
> $logger->info("principal INFO");
> $logger->error("principal ERROR");
> -------------------------------------------------
>=20
> config file
> -------------------------------------------------
> log4j.rootLogger =3D ERROR, B1, A1
>=20
> log4j.appender.A1=3DLog::Dispatch::Screen
> log4j.appender.A1.layout=3Dorg.apache.log4j.PatternLayout
> log4j.appender.A1.layout.ConversionPattern=3D%d [%t] %-5p %c - %m%n
>=20
> log4j.appender.B1 =3D Log::Dispatch::Syslog
> log4j.appender.B1.layout =3D Log::Log4perl::Layout::SimpleLayout
> log4j.appender.B1.name =3D file1
> log4j.appender.B1.min_level =3D error
> log4j.appender.B1.ident =3D prueba
> log4j.appender.B1.level =3D error
> log4j.appender.B1.facility =3D local1
> log4j.appender.B1.socket =3D inet
> -------------------------------------------------
>=20
> I have tried a simple script using only=20
> Syslog daemon and Log-Dispatch-2.01:
> ------------------------------------------------
> #! /usr/local/bin/perl
>=20
> use Log::Dispatch::Syslog;
>=20
> my $file =3D Log::Dispatch::Syslog->new( name =3D> 'file1',
> min_level =3D> 'info',
> socket =3D> 'inet',
> facility =3D> 'local1',
> ident =3D> 'prueba' );
>=20
> $file->log( level =3D> "error", message =3D> "un mensajito 3" );
> --------------------------------------------------------
> that work fine, so I think something is wrong in log4perl config
> file.
>=20
> Anyone can help me?
>=20
> Thanks
>=20
> --
> -----------------------------------------------------------------------=
-------
> p.d. (Only for future Spanish Translators)
> Te animas con alguna de las ayudas de gnome-core, gnome-applets o
> gnome-utils?
> http://www.linuxlots.com/~barreiro/spanish/gnome-es/v1.4/gnome-es-ayuda=
s-1.4.html
>=20
> Manuel de Vega Barreiro. mba...@re... En un lugar de la
> red
> Madrid. Espa=F1a. usuario linux: 17.419, 62.146 de cuyo nombre n=
o
> quiero
> http://www.linuxlots.com/~barreiro Linux Landia acordarme..........
> -----------------------------------------------------------------------=
-------
>=20
>=20
>=20
> -------------------------------------------------------
> This sf.net email is sponsored by: See the NEW Palm=20
> 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
--=20
Happy Trails . . .
Kevin M. Goess
(and Anne and Frank)
904 Carmel Ave.
Albany, CA 94706
(510) 525-5217
|