简体   繁体   中英

Using {% in jinja2 templates

I have a jinja2 template which contain value:

log4j.appender.AUDIT_LOGFILE.layout.ConversionPattern=[%d] %P%5p {%c}- %x %m %n

Since {%c} is treated as an expression, it is throwing an error. Is there any way to tell jinja2 not to render {%c}?

I want the final output contain {%c}.

根据手册的Escaping部分,您可以像这样输出:

{{ '{%c}' }}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM