Re^4: Import constants?
by BrowserUk (Patriarch) on Aug 05, 2010 at 08:52 UTC
|
use DBIx::Log4perl qw(:masks);
my $dbh = DBIx::Log4perl->connect(...);
$dnh->dbix_l4p_setattr(
'dbix_l4p_logmask',
DBIX_L4P_LOG_TXN | DBIC_L4P_LOG_CONNECT |
DBIX_L4P_LOG_INPUT | DBIX_L4P_LOG_ERRCAPTURE |
DBIX_L4P_LOG_ERRORS | DBIX_L4P_LOG_DBDSPECIFIC
);
...
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
|
Unfortunately it didn't do any difference.
I'm doing the following:
use Log::Log4perl;
use DBIx::Log4perl qw(:masks);
Log::Log4perl->init("myconfigfile.cfg");
$dbh = DBIx::Log4perl->connect($DSN, "user", "pass");
$dbh->dbix_l4p_setattr(
'dbix_l4p_logmask',
DBIX_L4P_LOG_TXN | DBIC_L4P_LOG_CONNECT |
DBIX_L4P_LOG_INPUT | DBIX_L4P_LOG_ERRCAPTURE |
DBIX_L4P_LOG_ERRORS | DBIX_L4P_LOG_DBDSPECIFIC
);
...
Maybe my problem is related to my usage of the config file? | [reply] [d/l] |
|
it didn't do any difference
The set of masks I posted is the default set as described in the first entry in the pod.
If you want the setting to be different, you'll have to choose which constants you want, and change the code to suit.
| [reply] |
|
|
|
Re^4: Import constants?
by DreamT (Pilgrim) on Aug 05, 2010 at 08:49 UTC
|
I get Can't locate auto/DBIx/Log4perl/st/_dbix_l4p_p.al in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.10.0/DBIx/Log4perl/st.pm line 281
when running it, so mayme i'm missing something? | [reply] [d/l] |
|
#!/usr/bin/perl -l
use DBIx::Log4perl qw(:masks);
$DBIx::Log4perl::LogMask = DBIX_L4P_LOG_OUTPUT | DBIX_L4P_LOG_INPUT;
print $DBIx::Log4perl::LogMask;
(prints '3', as expected) | [reply] [d/l] |
|
use DBIx::Log4perl qw(:masks);
$DBIx::Log4perl::LogMask = DBIX_L4P_LOG_OUTPUT | DBIX_L4P_LOG_INPUT;
Log::Log4perl->init("myconfig.cfg");
$dbh = DBIx::Log4perl->connect($DSN, "user", "pass");
Config-file:
log4perl.logger = FATAL, LOGFILE
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=logs/FATAL.TXT
log4perl.appender.LOGFILE.mode=append
log4perl.appender.LOGFILE.Threshold = ERROR
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%
+n
log4perl.logger.DBIx.Log4perl=DEBUG, A1
log4perl.appender.A1=Log::Log4perl::Appender::File
log4perl.appender.A1.filename=logs/OK.txt
log4perl.appender.A1.mode=append
log4perl.appender.A1.layout=Log::Log4perl::Layout::SimpleLayout
| [reply] [d/l] [select] |
|
$sth->_dbix_l4p_perl(2, # line 277
sub {Data::Dumper->Dump(
[$res],
["fetchrow_hashref($h->{dbh_no}.$sth->{private_DBIx_st_no}
+)"])})
if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);
with
$sth->_dbix_l4p_debug($h, 2, # line 277
...
AFAICT, there is no method _dbix_l4p_perl in any of the related packages (while there are similarly named ones like ..._debug, ..._info, etc.). No guarantees, though (untested). | [reply] [d/l] [select] |
|
...and of course it worked:-) Thanks a lot! Should I file a bug report to the author about this?
| [reply] |
|
| [reply] |
|
The subject did start out as something else - I wanted to learn how to use constants:) But I can see that v0.22 works "from scratch" after installing it on a new machine.
| [reply] |