Revision 54d656bd
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/DB.pm | ||
---|---|---|
13 | 13 |
|
14 | 14 |
my (%_db_registered, %_initial_sql_executed); |
15 | 15 |
|
16 |
sub dbi_connect { |
|
17 |
shift; |
|
18 |
|
|
19 |
return DBI->connect(@_) unless $::lx_office_conf{debug} && $::lx_office_conf{debug}->{dbix_log4perl}; |
|
20 |
|
|
21 |
require Log::Log4perl; |
|
22 |
require DBIx::Log4perl; |
|
23 |
|
|
24 |
my $filename = $LXDebug::file_name; |
|
25 |
my $config = $::lx_office_conf{debug}->{dbix_log4perl_config}; |
|
26 |
$config =~ s/LXDEBUGFILE/${filename}/g; |
|
27 |
|
|
28 |
Log::Log4perl->init(\$config); |
|
29 |
return DBIx::Log4perl->connect(@_); |
|
30 |
} |
|
31 |
|
|
16 | 32 |
sub create { |
17 | 33 |
my $domain = shift || SL::DB->default_domain; |
18 | 34 |
my $type = shift || SL::DB->default_type; |
config/lx_office.conf.default | ||
---|---|---|
28 | 28 |
|
29 | 29 |
# location of history file for permanent history |
30 | 30 |
history_file = users/console_history |
31 |
|
|
32 |
[debug] |
|
33 |
# Use DBIx::Log4perl for logging DBI calls. The string LXDEBUGFILE |
|
34 |
# will be replaced by the file name configured for $::lxdebug. |
|
35 |
dbix_log4perl = 0 |
|
36 |
dbix_log4perl_config = log4perl.logger = FATAL, LOGFILE |
|
37 |
= log4perl.appender.LOGFILE=Log::Log4perl::Appender::File |
|
38 |
= log4perl.appender.LOGFILE.filename=LXDEBUGFILE |
|
39 |
= log4perl.appender.LOGFILE.mode=append |
|
40 |
= log4perl.appender.LOGFILE.Threshold = ERROR |
|
41 |
= log4perl.appender.LOGFILE.layout=PatternLayout |
|
42 |
= log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%n |
|
43 |
= log4perl.logger.DBIx.Log4perl=DEBUG, A1 |
|
44 |
= log4perl.appender.A1=Log::Log4perl::Appender::File |
|
45 |
= log4perl.appender.A1.filename=LXDEBUGFILE |
|
46 |
= log4perl.appender.A1.mode=append |
|
47 |
= log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout |
|
48 |
= log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n |
Auch abrufbar als: Unified diff
Logging von Datenbankzugriffen auch von Rose via Log::Log4perl und DBIx::Log4perl ermöglichen