On Tue, Mar 18, 2014 at 10:22 PM, Claudio Steel
claudio.steel...@gmail.comwrote:
Yes, I'm pretty sure that is exactly what you mean and very smart idea.
However, I'd like to test small on this and rather than add and setup two
OTHER mods, I would like to just for this instance, statically add the file
path and make sure this thing has at least some life to it. So I changed
the line in my apps config file to
__PACKAGE__-log(Log::Log4perl::Catalyst-new('/var/www/docttour/log4perl.conf'));
instead of the relative path and its still goes boom.
On Tue, Mar 18, 2014 at 8:58 AM, claudio.steel.us
claudio.steel...@gmail.com wrote:
ok im very new to all of this so im a bit lost in what your explanation
is. Can I assume you mean that I need to declare the entire (absolute) file
path? secondly, this would break the app if I had it on a VN so i should
use the file::shardir thing?
Sent from my Samsung Galaxy Note™, an ATT LTE smartphone
ok im very new to all of this so im a bit lost in what your explanation
is. Can I assume you mean that I need to declare the entire (absolute) file
path? secondly, this would break the app if I had it on a VN so i should
use the file::shardir thing?
Sent from my Samsung Galaxy Note™, an ATT LTE smartphone
Alexander Hartmaier alex.hartma...@gmail.com wrote:
On Tue, Mar 18, 2014 at 7:59 AM, Claudio Steel
claudio.steel...@gmail.com wrote:
Ok I have read both of these but I'm a little fuzzy on what I did wrong
since it seems so straight forward.
1. Have it installed and added to the makefile
2. In my apps 'myapp.pm' I added
use Log::Log4perl::Catalyst;
and ...
__PACKAGE__-log(Log::Log4perl::Catalyst-new('log4perl.conf'));
3. I made a file chmod to 775 in the root directory of the app called
log4perl.conf.
4. In the config file i added the following:
#log4perl.category= WARN, Logfile
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = /log/debug.log
5. I made a directory, chmod to 775 recursive, in the root directory,
'log/debug.log'
The Catalyst application's root directory or /?
In case of /log/debug.log check the file permissions.
So, unless I comment line 1 of the config I get a 502 error. Once
commented the app restarts but doesn't log anything. Any ideas?
http 502? That's 'bad gateway' and normally only happens behind for example
a fastcgi proxy.
You didn't specify the absolute path of log4perl.conf and you can't rely
on the current directory.
Use File::ShareDir of what I suggested previously.
On Mon, Mar 17, 2014 at 9:38 AM, Alexander Hartmaier
alex.hartma...@gmail.com wrote:
On Mon, Mar 17, 2014 at 6:51 AM, Mike Schilli m...@perlmeister.comwrote:
On Fri, 14 Mar 2014, Claudio Steel wrote:
I have a new catalyst app and i think your module is exactly what I
need. However, I'm not
able to find where I can set the file path that I want the log to be
written to. Any advice
you have is appreciated.
Check out
http://search.cpan.org/~mschilli/Log-Log4perl-1.42/lib/Log/Log4perl/Catalyst.pm
which says that you can provide a configuration file like
__PACKAGE__-log(Log::Log4perl::Catalyst-new('l4p.conf'));
and in your configuration file you can specify a file appender with
a user-defined path:
# l4p.conf
log4perl.category = WARN, Logfile
I'm not sure if you can assign a log level and appender directory to
category, the Log4perl docs only show log4perl.rootLogger = and
log4perl.category.Foo.Bar = examples.
If all this still doesn't help try to get it working in a simple script
without Catalyst.
log4perl.appender.Logfile = Log::Log4perl::Appender::File
log4perl.appender.Logfile.filename = /foo/bar/test.log
log4perl.appender.Logfile.layout =
Log::Log4perl::Layout::PatternLayout
log4perl.appender.Logfile.layout.ConversionPattern = %d %F{1}
%L %m %n
Hope this helps!
--
-- Mike
That's how we do it in our Catalyst apps:
In the Catalyst app class:
=item finalize_config
Initializes the logger after the config file merging and loading is
done.
=cut
sub finalize_config {
my $class = shift;
$class-next::method(@_);
$class-log(Log::Log4perl::Catalyst-new($class-config-{log}));
}
That way we can configure the logging in the Catalyst config file(s)
loaded by Plugin::ConfigLoader with merging and not have a separate one
just for logging.
Best regards, Alex
Mike Schilli
m...@perlmeister.com
--
Learn Graph Databases - Download FREE O'Reilly Book
Graph Databases is the definitive new guide to graph databases and
their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
log4perl-devel mailing list