line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package DJabberd::Log::Junk; |
3
|
|
|
|
|
|
|
|
4
|
20
|
|
|
20
|
|
249935
|
use Log::Log4perl qw(:resurrect); |
|
20
|
|
|
|
|
1559709
|
|
|
20
|
|
|
|
|
159
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package DJabberd::Log; |
7
|
20
|
|
|
20
|
|
68688
|
use strict; |
|
20
|
|
|
|
|
46
|
|
|
20
|
|
|
|
|
383
|
|
8
|
20
|
|
|
20
|
|
537
|
use warnings; |
|
20
|
|
|
|
|
42
|
|
|
20
|
|
|
|
|
457
|
|
9
|
|
|
|
|
|
|
|
10
|
20
|
|
|
20
|
|
628
|
no warnings 'redefine'; |
|
20
|
|
|
|
|
44
|
|
|
20
|
|
|
|
|
438
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $has_run; |
13
|
|
|
|
|
|
|
our $logger; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub get_logger { |
16
|
0
|
|
|
0
|
0
|
0
|
my ($class, $category) = @_; |
17
|
0
|
|
|
|
|
0
|
my ($package, $filename, $line) = caller; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my $autostarted = 0; |
20
|
0
|
0
|
|
|
|
0
|
unless ($has_run) { |
21
|
0
|
|
|
|
|
0
|
my @locations = ( |
22
|
|
|
|
|
|
|
"etc/log.conf", |
23
|
|
|
|
|
|
|
"/etc/djabberd/log.conf", |
24
|
|
|
|
|
|
|
"etc/log.conf.default" |
25
|
|
|
|
|
|
|
); |
26
|
0
|
|
|
|
|
0
|
DJabberd::Log->set_logger(@locations); |
27
|
0
|
|
|
|
|
0
|
$autostarted = 1; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
0
|
|
|
0
|
my $ret = Log::Log4perl->get_logger($category || $package); |
31
|
|
|
|
|
|
|
# Let user know that we've used the hardcoded list of locations from above |
32
|
|
|
|
|
|
|
# rather than any special settings he might have wanted. |
33
|
0
|
0
|
|
|
|
0
|
$ret->logwarn("Logger was started on demand from ", $filename, " line ", $line) if $autostarted; |
34
|
0
|
|
|
|
|
0
|
return $ret; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub set_logger { |
38
|
20
|
|
|
20
|
0
|
1144
|
my ($class, @locations) = @_; |
39
|
|
|
|
|
|
|
|
40
|
20
|
|
|
|
|
47
|
my $used_file; |
41
|
20
|
50
|
|
|
|
117
|
@locations = () if $ENV{LOGLEVEL}; |
42
|
20
|
|
|
|
|
60
|
foreach my $conffile (@locations) { |
43
|
0
|
0
|
|
|
|
0
|
next unless -e $conffile; |
44
|
0
|
|
|
|
|
0
|
Log::Log4perl->init_and_watch($conffile, 1); |
45
|
0
|
|
|
|
|
0
|
$logger = Log::Log4perl->get_logger(); |
46
|
0
|
|
|
|
|
0
|
$used_file = $conffile; |
47
|
0
|
|
|
|
|
0
|
last; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
20
|
|
50
|
|
|
111
|
my $loglevel = $ENV{LOGLEVEL} || "WARN"; |
51
|
|
|
|
|
|
|
|
52
|
20
|
50
|
|
|
|
142
|
unless ($used_file) { |
53
|
20
|
|
|
|
|
98
|
my $conf = qq{ |
54
|
|
|
|
|
|
|
log4perl.logger.DJabberd = $loglevel, screen |
55
|
|
|
|
|
|
|
log4perl.logger.DJabberd.Hook = $loglevel |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# This psuedo class is used to control if raw XML is to be showed or not |
58
|
|
|
|
|
|
|
# at DEBUG it shows all raw traffic |
59
|
|
|
|
|
|
|
# at INFO it censors out the actual data |
60
|
|
|
|
|
|
|
log4perl.logger.DJabberd.Connection.XML = $loglevel |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
log4perl.appender.screen = Log::Log4perl::Appender::ScreenColoredLevels |
63
|
|
|
|
|
|
|
log4perl.appender.screen.layout = Log::Log4perl::Layout::PatternLayout |
64
|
|
|
|
|
|
|
log4perl.appender.screen.layout.ConversionPattern = %P %-5p %-40c %m %n |
65
|
|
|
|
|
|
|
}; |
66
|
20
|
|
|
|
|
143
|
Log::Log4perl->init(\$conf); |
67
|
20
|
|
|
|
|
462542
|
$logger = Log::Log4perl->get_logger(); |
68
|
20
|
|
|
|
|
7121
|
$used_file = "BUILT-IN-DEFAULTS"; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
20
|
|
|
|
|
161
|
$logger->info("Started logging using '$used_file'"); |
72
|
20
|
|
|
|
|
872
|
$has_run++; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
# Local Variables: |
76
|
|
|
|
|
|
|
# mode: perl |
77
|
|
|
|
|
|
|
# c-basic-indent: 4 |
78
|
|
|
|
|
|
|
# indent-tabs-mode: nil |
79
|
|
|
|
|
|
|
# End: |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |