gpt4 book ai didi

java - JSON 格式日志未翻译为西里尔文

转载 作者:行者123 更新时间:2023-12-01 09:28:39 25 4
gpt4 key购买 nike

这是我从 logback.xml 文件进行 jsonl 日志记录的附加程序

<?xml version="1.0" encoding="utf-8"?>
<appender name="JSONL_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/card_gate_json.jsonl</file>
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>logs/card_gate.%d{yyyy-MM-dd}.%i.log.zip</FileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>50MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<MinIndex>1</MinIndex>
<MaxIndex>50</MaxIndex>
</rollingPolicy>
</appender>

这是示例日志,请注意,西里尔文字采用 ascii 代码。

{"@timestamp":"2016-09-22T14:04:40.886+03:00","@version":1,"message":"CARD Gate \u0432\u0435\u0440\u0441\u0438\u044F 003.00","logger_name":"ru.billing.cardgate.Cardgate","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.902+03:00","@version":1,"message":"\u0418\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0439 \u0441 \u0431\u0430\u043D\u043A\u0430\u043C\u0438","logger_name":"ru.billing.cardgate.Cardgate","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.927+03:00","@version":1,"message":"\u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0440\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u0441\u0432\u044F\u0437\u0438 \u0441 \u0431\u0430\u043D\u043A\u0430\u043C\u0438. \u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 acquire_emulator_mode = true","logger_name":"ru.billing.cardgate.bankclient.BankFactory","thread_name":"main","level":"WARN","level_value":30000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.928+03:00","@version":1,"message":"\u0421\u0442\u0430\u0440\u0442 HTTPS \u0441\u0435\u0440\u0432\u0435\u0440\u0430","logger_name":"ru.billing.cardgate.Cardgate","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.933+03:00","@version":1,"message":"Last transaction number before initialisation is 123 date Thu Sep 22 00:00:00 MSK 2016","logger_name":"ru.billing.cardgate.context.TransactionCounter","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.934+03:00","@version":1,"message":"Calendar day of year value 266","logger_name":"ru.billing.cardgate.context.TransactionCounter","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.938+03:00","@version":1,"message":"SAXBuilder pool initialized with 2 SAXBuilder","logger_name":"ru.billing.cardgate.context.saxPool.SaxPool","thread_name":"main","level":"DEBUG","level_value":10000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.938+03:00","@version":1,"message":"Current directory: C:\\Users\\Sultan.Isaev\\Desktop\\SFolder\\Code\\unipay_iso8583_gate\\User_Part\\UNIPAY_ISO8583_GATE","logger_name":"ru.billing.cardgate.server.CardServer","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.938+03:00","@version":1,"message":"\u0425\u0440\u0430\u043D\u0438\u043B\u0438\u0449\u0435 \u043A\u043B\u044E\u0447\u0435\u0439: src/certificates/server.jks","logger_name":"ru.billing.cardgate.server.CardServer","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:40.974+03:00","@version":1,"message":"\u0417\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u0441\u0435\u0440\u0432\u0435\u0440 \u043D\u0430 \u043F\u043E\u0440\u0442\u0443: 8090","logger_name":"ru.billing.cardgate.server.CardServer","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:41.222+03:00","@version":1,"message":"\u041F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 \u0441\u043B\u0443\u0448\u0430\u0435\u0442 \u043F\u043E\u0440\u0442: 8090","logger_name":"ru.billing.cardgate.server.CardServer","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}
{"@timestamp":"2016-09-22T14:04:41.223+03:00","@version":1,"message":"\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0434\u043D\u043E\u0432\u0440\u0435\u043C\u0435\u043D\u043D\u043E \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u043C\u044B\u0445 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0439: 2","logger_name":"ru.billing.cardgate.server.CardServer","thread_name":"main","level":"INFO","level_value":20000,"HOSTNAME":"WKS-18384"}

我需要用俄语写日志。请知道的人帮帮忙。

最佳答案

以为它在编码器标签中。

<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<charset>UTF-8</charset>
</encoder>

旧日志可以用java工具转换;这里改为 UTF-8。

ascii2native -encoding UTF-8 your.log >your_utf8.log

关于java - JSON 格式日志未翻译为西里尔文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39640004/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com