Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以使用 ColdFusion 来记录 UTF-8 数据(例如:汉字)<cflog>?
<cflog>
默认情况下,它只记录问号而不是字符。
我知道我可以使用文件 API 打开/写入/关闭日志文件,但我不想让日志记录这样简单的事情变得过于复杂。
是的,但是您需要告诉整个 JVM 以 UTF-8 格式处理文件。您可以通过将其添加到 jvm.config 中的 java.args 来执行此操作:
-Dfile.encoding=utf8
参考。
您也可以log4j.appender.LOGFILE.encoding=UTF-8在 ColdFusion 的/lib/log4j.properties文件中进行设置,而不影响整个 VM。虽然如果亚当的解决方案有效,我不一定会改变它。
log4j.appender.LOGFILE.encoding=UTF-8
/lib/log4j.properties