zoukankan      html  css  js  c++  java
  • 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
    

  • 相关阅读:
    Sliverlight之 矢量绘图
    Silverlight之 xaml布局
    七天学会ASP.NET MVC(七)——创建单页应用
    MVC视图之间调用方法总结
    C#取得程序的根目录以及判断文件是否存在
    七天学会ASP.NET MVC (六)——线程问题、异常处理、自定义URL
    [C#] .NET4.0中使用4.5中的 async/await 功能实现异步
    C#中StreamReader读取中文文本出现乱码的解决方法
    七天学会ASP.NET MVC (五)——Layout页面使用和用户角色管理
    常用正则表达式
  • 原文地址:https://www.cnblogs.com/lori/p/15726404.html
Copyright © 2011-2022 走看看