You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/09/18 23:13:27 UTC
[incubator-ponymail-foal] branch master updated: Add some logging
options
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 68af4d0 Add some logging options
68af4d0 is described below
commit 68af4d0806c3d5ce0407cda1bc6028ea85bea3d5
Author: Sebb <se...@apache.org>
AuthorDate: Sun Sep 19 00:11:59 2021 +0100
Add some logging options
---
server/main.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/server/main.py b/server/main.py
index 185b9fe..8de9fd8 100644
--- a/server/main.py
+++ b/server/main.py
@@ -81,6 +81,16 @@ class Server(plugins.server.BaseServer):
print(
f"Could not find entry point 'register()' in {endpoint_file}, skipping!"
)
+ if args.logger:
+ import logging
+ es_trace_logger = logging.getLogger('elasticsearch')
+ es_trace_logger.setLevel(args.logger)
+ es_trace_logger.addHandler(logging.StreamHandler())
+ if args.trace:
+ import logging
+ es_trace_logger = logging.getLogger('elasticsearch.trace')
+ es_trace_logger.setLevel(args.trace)
+ es_trace_logger.addHandler(logging.StreamHandler())
async def handle_request(
self, request: aiohttp.web.BaseRequest
@@ -198,6 +208,14 @@ if __name__ == "__main__":
help="Configuration file to load (default: ponymail.yaml)",
default="ponymail.yaml",
)
+ parser.add_argument(
+ "--logger",
+ help="elasticsearch level (e.g. INFO or DEBUG)",
+ )
+ parser.add_argument(
+ "--trace",
+ help="elasticsearch.trace level (e.g. INFO or DEBUG)",
+ )
cliargs = parser.parse_args()
pubsub_server = Server(cliargs)
pubsub_server.run()