• jboss~静态文件路由和自定义日志


    由于我的jboss项目去在容器中运行的,所以我习惯上把这些扩展功能添加到cli文件 ,然后在Dockerfile里把它们进行添加,动态为主程序添加功能。

    • Dockerfile
    FROM jboss/keycloak:14.0.0
    USER root
    # 日志
    ADD log4.cli /opt/jboss/startup-scripts/
    # 静态文件路由
    ADD static_resource.cli /opt/jboss/startup-scripts/
    
    • log4.cli
    embed-server --server-config=standalone-ha.xml --std-out=echo
    batch
    
    /subsystem=logging/logger=org.keycloak.events:add
    /subsystem=logging/logger=org.keycloak.events:write-attribute(name=level,value=DEBUG)
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:add(file={path=events.log,relative-to=jboss.server.log.dir})
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=level,value=DEBUG)
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=rotate-size, value=10M)
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=max-backup-index, value=5)
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=append,value=true)
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")
    /subsystem=logging/size-rotating-file-handler=EVENTLOG:write-attribute(name=autoflush,value=true)
    /subsystem=logging/root-logger=ROOT:add-handler(name=EVENTLOG)
    
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:add(file={path=access_log.log,relative-to=jboss.server.log.dir})
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=level,value=INFO)
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=rotate-size, value=10M)
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=max-backup-index, value=5)
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=append,value=true)
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")
    /subsystem=logging/size-rotating-file-handler=ACCESSLOG:write-attribute(name=autoflush,value=true)
    /subsystem=logging/root-logger=ROOT:add-handler(name=ACCESSLOG)
    
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:add(file={path=server.log,relative-to=jboss.server.log.dir})
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=level,value=INFO)
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=rotate-size, value=10M)
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=max-backup-index, value=5)
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=append,value=true)
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=formatter,value="%d{yyyy-MM-dd HH\:mm\:ss,SSS} %-5p [%c] (%t) %s%e%n")
    /subsystem=logging/size-rotating-file-handler=SERVERLOG:write-attribute(name=autoflush,value=true)
    /subsystem=logging/root-logger=ROOT:add-handler(name=SERVERLOG)
    
    run-batch
    stop-embedded-server
    
    • static_resource.cli
    embed-server --server-config=standalone-ha.xml --std-out=echo
    batch
    /subsystem=undertow/configuration=handler/file=static_resource:add(path="/opt/jboss/keycloak/standalone/welcome-content")
    /subsystem=undertow/server=default-server/host=default-host/location=\/:write-attribute(name=handler,value=static_resource)
    run-batch
    stop-embedded-server
    

  • 相关阅读:
    【BZOJ1029】[JSOI2007] 建筑抢修(堆优化贪心)
    【CF799B】T-shirt buying(一道很水的小根堆)
    【BZOJ1076】[SCOI2008] 奖励关(状压DP)
    【BZOJ1087】[SCOI2005] 互不侵犯King(状压DP)
    【BZOJ3209】花神的数论题(数位DP)
    【BZOJ1833】[ZJOI2010] count 数字计数(数位DP)
    【洛谷】CYJian的水题大赛 解题报告
    【洛谷3959】宝藏(随机算法乱搞)
    【洛谷2709】小B的询问(莫队模板题)
    【洛谷2403】[SDOI2010] 所驼门王的宝藏(Tarjan+dfs遍历)
  • 原文地址:https://www.cnblogs.com/lori/p/15726404.html
Copyright © 2020-2023  润新知