Revision 82bb6389
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/LXDebug.pm | ||
---|---|---|
39 | 39 |
my $type = shift; |
40 | 40 |
my $self = {}; |
41 | 41 |
|
42 |
_init_globals_from_config(); |
|
43 |
|
|
42 | 44 |
$self->{"calldepth"} = 0; |
43 | 45 |
$self->{"file"} = $file_name || "/tmp/lx-office-debug.log"; |
44 | 46 |
$self->{"target"} = FILE_TARGET; |
... | ... | |
53 | 55 |
bless($self, $type); |
54 | 56 |
} |
55 | 57 |
|
58 |
my $globals_inited_from_config; |
|
59 |
sub _init_globals_from_config { |
|
60 |
return if $globals_inited_from_config; |
|
61 |
$globals_inited_from_config = 1; |
|
62 |
|
|
63 |
my $cfg = $::lx_office_conf{debug} || {}; |
|
64 |
|
|
65 |
$global_level = NONE() if $cfg->{global_level} =~ /NONE/; |
|
66 |
foreach my $level (grep { $_} split(m/\s+/, $cfg->{global_level})) { |
|
67 |
$global_level |= eval "${level}()"; |
|
68 |
} |
|
69 |
|
|
70 |
$watch_form = $cfg->{watch_form}; |
|
71 |
$file_name = $cfg->{file_name} || "/tmp/lx-office-debug.log"; |
|
72 |
} |
|
73 |
|
|
56 | 74 |
sub set_target { |
57 | 75 |
my ($self, $target, $file) = @_; |
58 | 76 |
|
config/lx-erp.conf | ||
---|---|---|
106 | 106 |
$pg_dump_exe = "pg_dump"; |
107 | 107 |
$pg_restore_exe = "pg_restore"; |
108 | 108 |
|
109 |
# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind |
|
110 |
# LXDebug::NONE - keine Debugausgaben |
|
111 |
# LXDebug::INFO |
|
112 |
# LXDebug::DEBUG1 |
|
113 |
# LXDebug::DEBUG2 |
|
114 |
# LXDebug::QUERY - SQL Queries |
|
115 |
# LXDebug::TRACE - Tracing von Funktionsaufrufen |
|
116 |
# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird |
|
117 |
# LXDebug::REQUEST_TIMER - Timing von Requests loggen |
|
118 |
# LXDebug::WARN - warnings |
|
119 |
# LXDebug::ALL - alle Debugausgaben |
|
120 |
# |
|
121 |
# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR |
|
122 |
# |
|
123 |
# Beipiel: |
|
124 |
# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY; |
|
125 |
$LXDebug::global_level = LXDebug->NONE; |
|
126 |
|
|
127 |
# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja, |
|
128 |
# dann können einzelne Variablen mit |
|
129 |
# $form->{"Watchdog::<variablenname>"} = 1; |
|
130 |
# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust, |
|
131 |
# weshalb sie normalerweise deaktiviert ist. |
|
132 |
$LXDebug::watch_form = 0; |
|
133 |
|
|
134 | 109 |
1; |
config/lx-erp.conf.default | ||
---|---|---|
106 | 106 |
$pg_dump_exe = "pg_dump"; |
107 | 107 |
$pg_restore_exe = "pg_restore"; |
108 | 108 |
|
109 |
# Globale Debug-Ausgaben (de-)aktivieren? Moegliche Werte sind |
|
110 |
# LXDebug::NONE - keine Debugausgaben |
|
111 |
# LXDebug::INFO |
|
112 |
# LXDebug::DEBUG1 |
|
113 |
# LXDebug::DEBUG2 |
|
114 |
# LXDebug::QUERY - SQL Queries |
|
115 |
# LXDebug::TRACE - Tracing von Funktionsaufrufen |
|
116 |
# LXDebug::BACKTRACE_ON_ERROR - Vollständiger Aufrufpfad, wenn $form->error() aufgerufen wird |
|
117 |
# LXDebug::REQUEST_TIMER - Timing von Requests loggen |
|
118 |
# LXDebug::WARN - warnings |
|
119 |
# LXDebug::ALL - alle Debugausgaben |
|
120 |
# |
|
121 |
# LXDebug::DEVEL - wie INFO | QUERY | TRACE | BACKTRACE_ON_ERROR |
|
122 |
# |
|
123 |
# Beipiel: |
|
124 |
# $LXDebug::global_level = LXDebug::TRACE | LXDebug::QUERY; |
|
125 |
$LXDebug::global_level = LXDebug->NONE; |
|
126 |
|
|
127 |
# Überwachung der Inhalte von $form aktiviert oder nicht? Wenn ja, |
|
128 |
# dann können einzelne Variablen mit |
|
129 |
# $form->{"Watchdog::<variablenname>"} = 1; |
|
130 |
# überwacht werden. Bedeutet aber auch einen Geschwindigkeitsverlust, |
|
131 |
# weshalb sie normalerweise deaktiviert ist. |
|
132 |
$LXDebug::watch_form = 0; |
|
133 |
|
|
134 | 109 |
1; |
config/lx_office.conf.default | ||
---|---|---|
9 | 9 |
[periodic_invoices] |
10 | 10 |
# The user name a report about the posted and printed invoices is sent |
11 | 11 |
# to. |
12 |
send_email_to = login
|
|
12 |
send_email_to = mb
|
|
13 | 13 |
# The "From:" header for said email. |
14 | 14 |
email_from = Lx-Office Daemon <root@localhost> |
15 | 15 |
# The subject for said email. |
... | ... | |
19 | 19 |
|
20 | 20 |
[Console] |
21 | 21 |
# autologin to use if none is given |
22 |
login = demo
|
|
22 |
login = mb
|
|
23 | 23 |
|
24 | 24 |
# autorun lines will be executed after autologin. |
25 | 25 |
# be warned that loading huge libraries will noticably lengthen startup time. |
26 |
#autorun = use SL::Module |
|
27 |
# = use SL::Other::Module |
|
26 |
autorun = require "bin/mozilla/common.pl"; |
|
27 |
= use English qw(-no_match_vars); |
|
28 |
= use List::Util qw(min max); |
|
29 |
= use Sort::Naturally; |
|
30 |
= my ($a, $b, $e, $f, @a1, @a2, %h); |
|
31 |
= sub take { my $max = shift; my $r = ref($_[0]) eq 'ARRAY' ? $_[0] : \@_; return @{$r}[0..List::Util::min($max, scalar(@{$r})) - 1]; } |
|
28 | 32 |
|
29 | 33 |
# location of history file for permanent history |
30 | 34 |
history_file = users/console_history |
31 | 35 |
|
32 |
# Settings used when the user changes his/her password. All options |
|
33 |
# default to no restriction if unset. |
|
34 |
[password_policy] |
|
35 |
# Minimum length in number of characters. |
|
36 |
min_length = |
|
37 |
# Maximum length in number of characters. |
|
38 |
max_length = |
|
39 |
# Require a lowe-case character? |
|
40 |
require_lowercase = |
|
41 |
# Require an upper-case character? |
|
42 |
require_uppercase = |
|
43 |
# Require a digit? |
|
44 |
require_digit = |
|
45 |
# Require a special char? Special chars are the following: |
|
46 |
# ! " # $ % & ' ( ) * + , - . : ; < = > ? @ [ \ ] ^ _ { | } |
|
47 |
require_special_character = |
|
48 |
# Optional list of valid characters. Spaces are ignored. If set then |
|
49 |
# the password must only consist of these characters. |
|
50 |
valid_characters = |
|
51 |
# Optional list of invalid characters. Spaces are ignored. |
|
52 |
invalid_characters = |
|
53 |
# Whether or not to check the policy if the password is set from the |
|
54 |
# user administration. |
|
55 |
disable_policy_for_admin = |
|
56 |
# Whether or not to check for weak passwords with the "cracklib" |
|
57 |
# library. Requires the Perl module "Crypt::Cracklib" to be installed. |
|
58 |
use_cracklib = |
|
59 |
|
|
60 | 36 |
[debug] |
61 | 37 |
# Use DBIx::Log4perl for logging DBI calls. The string LXDEBUGFILE |
62 | 38 |
# will be replaced by the file name configured for $::lxdebug. |
... | ... | |
75 | 51 |
= log4perl.appender.A1.layout=Log::Log4perl::Layout::PatternLayout |
76 | 52 |
= log4perl.appender.A1.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n |
77 | 53 |
|
54 |
# Activate certain global debug messages. If you want to combine |
|
55 |
# several options then list them seperated by spaces. |
|
56 |
# |
|
57 |
# Possible values include: |
|
58 |
# NONE - no debug output (default) |
|
59 |
# INFO |
|
60 |
# DEBUG1 |
|
61 |
# DEBUG2 |
|
62 |
# QUERY - Dump SQL queries (only in legacy code; see also "dbix_log4perl" above) |
|
63 |
# TRACE - Track function calls and returns |
|
64 |
# BACKTRACE_ON_ERROR - Print a function call backtrace when $form->error() is called |
|
65 |
# REQUEST_TIMER - Log timing of HTTP requests |
|
66 |
# WARN - warnings |
|
67 |
# ALL - all possible debug messages |
|
68 |
# |
|
69 |
# DEVEL - sames as "INFO QUERY TRACE BACKTRACE_ON_ERROR REQUEST_TIMER" |
|
70 |
# |
|
71 |
# Example: |
|
72 |
# global_level = TRACE QUERY |
|
73 |
global_level = NONE |
|
74 |
|
|
75 |
# Activate monitoring of the content of $form. If it is active then |
|
76 |
# monitoring can be turned on for certain variables with the |
|
77 |
# following: |
|
78 |
# $form->{"Watchdog::<variable>"} = 1; |
|
79 |
# Monitoring has a performance cost and is therefore deactivated by |
|
80 |
# default. |
|
81 |
watch_form = 0 |
|
82 |
|
|
78 | 83 |
# If you want to debug the creation of LaTeX files then set this to 1. |
79 | 84 |
# That way the temporary LaTeX files created during PDF creation are |
80 | 85 |
# not removed and remain in the "users" directory. |
81 | 86 |
keep_temp_files = 0 |
87 |
|
|
88 |
# The file name where the debug messages are written to. |
|
89 |
file_name = /tmp/lx-office-debug.log |
Auch abrufbar als: Unified diff
Initialisierung von LXDebug von lx-erp.conf nach lx_office.conf verschoben