Skip to content

Commit 4ec8502

Browse files
author
Neil Booth
committedMar 12, 2018
Add LOG_FORMAT envvar to control logging format.
1 parent 60761b3 commit 4ec8502

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
 

‎docs/ENVIRONMENT.rst

+8-1
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,16 @@ Miscellaneous
6464

6565
These environment variables are optional:
6666

67+
* **LOG_FORMAT**
68+
69+
The Python logging `format string
70+
<https://docs.python.org/3/library/logging.html#logrecord-attributes>`_
71+
to use. Defaults to `%(levelname)s:%(name)s:%(message)s`.
72+
6773
* **ALLOW_ROOT**
6874

69-
Set this environment variable to anything non-empty to allow running ElectrumX as root.
75+
Set this environment variable to anything non-empty to allow running
76+
ElectrumX as root.
7077

7178
* **NET**
7279

‎electrumx_server.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
def main():
2020
'''Set up logging and run the server.'''
21-
logging.basicConfig(level=logging.INFO,
22-
format='%(asctime)s %(levelname)-7s %(message)-100s '
23-
'[%(filename)s:%(lineno)d]')
21+
log_fmt = Env.default('LOG_FORMAT', '%(levelname)s:%(name)s:%(message)s')
22+
logging.basicConfig(level=logging.INFO, format=log_fmt)
2423
logging.info('ElectrumX server starting')
2524
try:
2625
controller = Controller(Env())

0 commit comments

Comments
 (0)
Please sign in to comment.