Open GoogleCodeExporter opened 8 years ago
getting error in windows, the file maps.exe.log used to be created only when
there was a real error
Original comment by heldersepu
on 6 Nov 2010 at 3:26
If I understand correctly:
- maps.py - used in linux writes output to standard out and stderr - on console
User must use output redirecting to catch output into file. No file is
generated automaticly.
- maps.py - used in windows writes output to standard out and stderr - on
console
User must use output redirecting to catch output into file. No file is
generated automaticly.
- maps.exe - generated by p2exe - uses default behavior - ignores stdout,
stderr writes into mqps.exe.log and displays dialog box "See the logfile for
details". File maps.exe.log is generated automaticly if anything is printed to
stderr.
Using logging module will give more control over log output.
Implementation proposition:
- log format will be set in mapsConst.py
- log file path and name will be set in mapsConst.py
- default log level will be set to error. So only messages with severity error
or higher will be logged.
- log file name will be: gmapcatcher.log
- log file will be overwriten on each gmapcatcher restart
- for log file path I suggest to use same directory where gmapcatcher.conf is
placed. We need to do some writing into directory. We know, that it is possible
for directory. Directory with maps.exe is dedicated for program code. It should
not be used for program generated output.
- all exceptions should be catched. In exception handler exception would be
dealt and/or logged using logging.
- all output to stderr should be logged using logging mechanism with severity
error or higher.
Change to current behavior - is it OK?
- stderr will be overriden to output file in same directory with
gmapcatcher.conf. If there is still some output to stderr, which should not be,
we don't want to lost it. After redirecting there will be no message after
closing maps.exe even thought there was an output to stderr.
Using logging mechanism should be something like:
import logging
log = logging.getLogger(__name__)
and anywhere in the code use:
log.<log_level_function>( message )
If there are no objections with proposed behavior I will replace print
statements with logging in the existing code.
Original comment by standa31...@gmail.com
on 10 Nov 2010 at 7:59
Re-commited.
Hope it's better now - not changing default behavior.
See docstrings in r1075
Please report if there is a problem in any situations.
Original comment by standa31...@gmail.com
on 19 Nov 2010 at 6:04
Good, I just made windows installer and no problems
I guess we should provide an easy way to change the "default behavior" instead
of having the log format set in mapsConst.py we should consider add it to the
mapConf.py just like 'auto_refresh' is an option that the user can modify in
the configuration file.
Original comment by heldersepu
on 22 Nov 2010 at 1:43
Reason I used mapConst is to have logging set up as fast as possible. Befor
configuration file is read. IMO logging should be able to catch error messages
while reading config file.
Logging settings is in-fact configuration setting so it should go to
configuration file. So maybe some hybrid solution - like - set basics in
mapConst - to catch readConfigu errors and after config file is read modify
settings to users-like?
Original comment by standa31...@gmail.com
on 23 Nov 2010 at 10:32
hybrid Sounds great! we keep the default in mapConst and if there is a
"logging=1" we change the log level to something else
Original comment by heldersepu
on 23 Nov 2010 at 1:48
I been reading more your code and I see that the "default behavior" changes
when the user enters "--logging-path=" as one of the args. That is enough no
need to add it to the mapConf.py
Original comment by heldersepu
on 23 Nov 2010 at 3:17
OK, I'm fine with that. :)
Original comment by standa31...@gmail.com
on 24 Nov 2010 at 8:25
Original issue reported on code.google.com by
standa31...@gmail.com
on 2 Mar 2010 at 9:45