File tree Expand file tree Collapse file tree 4 files changed +19
-21
lines changed
searchcommands_app/default
searchcommands_scaffolding/default Expand file tree Collapse file tree 4 files changed +19
-21
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ author = Splunk
1010version = 1.0
1111
1212[package]
13- id = custom_search_commands
13+ id = searchcommands_app
1414
1515[install]
1616is_configured = 1
Original file line number Diff line number Diff line change 22keys = root, CountMatchesCommand, SimulateCommand, SumCommand
33
44[logger_root]
5- level = DEBUG ; Default: WARNING
5+ level = DEBUG ; Default: WARNING
66handlers = stderr ; Default: stderr
77
88[logger_CountMatchesCommand]
99qualname = CountMatchesCommand
10- level = NOTSET ; Default: WARNING
10+ level = NOTSET ; Default: WARNING
1111handlers = stderr ; Default: stderr
1212
1313[logger_SimulateCommand]
1414qualname = SimulateCommand
15- level = NOTSET ; Default: WARNING
15+ level = NOTSET ; Default: WARNING
1616handlers = stderr ; Default: stderr
1717
1818[logger_SumCommand]
1919qualname = SumCommand
20- level = NOTSET ; Default: WARNING
20+ level = NOTSET ; Default: WARNING
2121handlers = stderr ; Default: stderr
2222
2323[handlers]
24- keys=file, stderr
25-
26- [handler_file]
27- class = logging.FileHandler
28- level = NOTSET
29- args = ('custom_search_commands.log',)
30- formatter = search_command
24+ keys=stderr
3125
3226[handler_stderr]
3327class = logging.StreamHandler
Original file line number Diff line number Diff line change @@ -11,13 +11,7 @@ level = WARNING ; Default: WARNING
1111handlers = stderr ; Default: stderr
1212
1313[handlers]
14- keys=file, stderr
15-
16- [handler_file]
17- class = logging.FileHandler
18- level = NOTSET
19- args = ('%(app_id).log',)
20- formatter = search_command
14+ keys=stderr
2115
2216[handler_stderr]
2317class = logging.StreamHandler
Original file line number Diff line number Diff line change @@ -43,14 +43,24 @@ def configure(cls, path=None):
4343 The current directory is reset to its previous value before this function
4444 returns.
4545
46+ #Arguments:
47+
4648 :param cls: Class contained in <app-root>/bin/<module>.py
49+ :type cls: type
4750 :param path: Location of an alternative logging configuration file or `None`
51+ :type path: str or NoneType
4852
4953 """
54+ logger_name = cls .__name__
5055 module = inspect .getmodule (cls )
5156 app_directory = os .path .dirname (os .path .dirname (module .__file__ ))
5257 if path is None :
53- for relative_path in 'local/logging.conf' , 'default/logging.conf' :
58+ probing_path = [
59+ 'local/%s.logging.conf' % logger_name ,
60+ 'default/%s.logging.conf' % logger_name ,
61+ 'local/logging.conf' ,
62+ 'default/logging.conf' ]
63+ for relative_path in probing_path :
5464 configuration_file = os .path .join (app_directory , relative_path )
5565 if os .path .exists (configuration_file ):
5666 path = configuration_file
@@ -63,5 +73,5 @@ def configure(cls, path=None):
6373 fileConfig (path )
6474 finally :
6575 os .chdir (working_directory )
66- logger = getLogger (cls . __name__ )
76+ logger = getLogger (logger_name )
6777 return logger , path
You can’t perform that action at this time.
0 commit comments