Open feeeper opened 1 year ago
I've found the page about logging metrics in JSON format and this works fine for metrics (model_metrics
and ts_metrics
) but doesn't work for access_log
: all lines in access_log.log
file look like:
org.apache.logging.log4j.core.impl.MutableLogEvent@1ac5a7ff
It seems like JSONPatternLayout
does not work for logging access_log
? So how I can log access_log
s in JSON format?
PS: log4j2.xml
section for access_log
:
<RollingFile
name="access_log"
fileName="${env:LOG_LOCATION:-logs}/access_log.log"
filePattern="${env:LOG_LOCATION:-logs}/access_log.%d{dd-MMM}.log.gz">
<!-- <PatternLayout pattern="%d{ISO8601} - %m%n"/> -->
<JSONPatternLayout/>
<Policies>
<SizeBasedTriggeringPolicy size="100 MB"/>
<TimeBasedTriggeringPolicy/>
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
Any updates?
🐛 Describe the bug
I've configured log4j to log using
JsonTemplateLayout
. Below the part of the originallog4j.xml
:Then I start torchserve as usual:
And I got the error message
Error logs
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance. 2023-05-23 18:52:00,570 main ERROR Console contains an invalid element or attribute "JsonTemplateLayout"
Installation instructions
Install torchserve from source: No Are you using Docker: No
TorchServe was installed using
pip
Model Packaing
The model
sentence-transformers/paraphrase-multilingual-mpnet-base-v2
from HuggingFace Hubconfig.properties
Versions
Repro instructions
PatternLayout
node in theConsole[name=STDOUT]
node in the log4j2.xml with<JsonTemplateLayout eventTemplateUri="classpath:EcsLayout.json"/>
:ts.config
file:transformers_vectorizer_handler.py
could be any, example below):The error below is an actual result:
The expected result is log should be in JSON format supported by ELK-stack
transformers_vectorizer_handler.py
Possible Solution
No response