On Tue, 17 Jul 2007, Mesdaq, Ali wrote: > Great I am going to read the documentation on that now. Maybe you should > rename easy mode to something more inviting for us geeks :-) we all like > to think of ourselves as power users.
Maybe this :) ? use Log::Log4perl qw(:lazy); > Anyways after looking at the docs some more I didn't see a way I could > setup email dispatcher's for certain log level's or categories. At > first I was assuming I could pass any hashref to easy_init and it > would initialize based on that. easy_init() is for simple screen/file appenders only. But you can certainly combine :easy mode (giving you DEBUG/INFO/... macros and the stealth loggers) with init() and a regular configuration file. Gives you the best of both worlds. If you don't want a config file, you can use init() with a string or a hashref as outlined in the docs. -- Mike Mike Schilli [EMAIL PROTECTED] > But I looked at the code for easy_init and it looks like the only >options available are level, file, category, and layout. I think it >would be really flexible if the options to pass in are mapped closely >to conf file settings or just take all settings as if they were lines >of a config file. > > Maybe its possible via some other method but the easy_init looks like > its not doing that now and based on the docs I was reading it seems the > only way to initialize in easy mode is via easy_init. > > Thanks, > ------------------------------------------ > Ali Mesdaq > Security Researcher II > Websense Security Labs > http://www.WebsenseSecurityLabs.com > ------------------------------------------ > > -----Original Message----- > From: Mike Schilli [mailto:[EMAIL PROTECTED] > Sent: Sunday, July 15, 2007 10:02 AM > To: Mesdaq, Ali > Cc: log4perl-devel@lists.sourceforge.net > Subject: Re: [log4perl-devel] Initializing Question > > On Fri, 13 Jul 2007, Mesdaq, Ali wrote: > > > The usual order that things are used in my case I write some > > functionality in a module and I might call another module which calls > > another and I will write a script that interfaces with the first > > module. Ideally I wish I could have shortcut calls like in the easy > > mode to save the extra typing of $this->{logger}->. Shortcuts in > > typing make log::trace appealing but it can't compare in > > functionality. > > I think what you need is already there: Just use :easy mode. > > In a package, if you write > > package Foo; > use Log::Log4perl qw(:easy); > > then Log4perl will do two things when the module gets loaded: > > 1) Create a 'stealth logger' for the package > 2) Introduce TRACE/DEBUG/INFO/WARN ... macros so that you don't > have to run get_logger() to log something. > > The macros will use the 'stealth logger', so they don't have to call > get_logger() internally (explained in the main Log::Log4perl manpage). > > Easy mode is not only for simple scripts. It usually runs even faster > than regular mode. I'm using it almost exclusively in everything I > write, easy or complex. > > > I have to say log4perl is a nice piece of work. You can appreciate it > > so much more after you spend some time writing your own logging module > > > and resolving annoying issues then you see a super logging module like > > > this. > > Thanks for the note, I appreciate it! > > -- Mike > > Mike Schilli > [EMAIL PROTECTED] > > > > > Thanks, > > ------------------------------------------ > > Ali Mesdaq > > Security Researcher II > > Websense Security Labs > > http://www.WebsenseSecurityLabs.com > > ------------------------------------------ > > > > ---------------------------------------------------------------------- > > --- This SF.net email is sponsored by DB2 Express Download DB2 Express > > > C - the FREE version of DB2 express and take control of your XML. No > > limits. Just data. Click to get it now. > > http://sourceforge.net/powerbar/db2/ > > _______________________________________________ > > log4perl-devel mailing list > > log4perl-devel@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/log4perl-devel > > > ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ log4perl-devel mailing list log4perl-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/log4perl-devel