这是最直观的方式,适合不熟悉命令行的管理员:
http://<服务器IP>:7001/console/(默认端口7001),输入管理员账号密码登录。Environment → Servers,选择需要调整的目标服务器实例(如AdminServer)。Logging tab。这里可设置控制台日志级别(Console Log Level)和文件日志级别(File Log Level),常见级别从低到高为:FINEST(最详细)、FINER、FINE、CONFIG、INFO(默认)、WARNING、SEVERE(最简略)。选择所需级别后,点击Save保存配置。logging.xml是WebLogic日志级别的核心配置文件,直接修改它可实现永久生效:
$WL_HOME/wlserver/server/lib/logging.xml($WL_HOME为WebLogic安装目录);$DOMAIN_HOME/config/fmwconfig/servers/<server_name>/logs/logging.xml(<server_name>为目标服务器实例名,如AdminServer)。vi或nano等文本编辑器打开logging.xml,找到以下关键标签调整级别:
<console-log-handler>标签的severity属性(如severity="INFO");<logging-file-handler>标签的level属性(如level="FINE")。<console-log-handler name="ConsoleHandler" severity="INFO">
<formatter>com.bea.jmx.naming.ConsoleFormatter</formatter>
</console-log-handler>
<logging-file-handler name="FileHandler" level="FINE" encoding="UTF-8" mode="append"
file-location="${com.bea.wlp.logging.file.directory}/${com.bea.wlp.logging.file.prefix}.log"/>
./stopWebLogic.sh && ./startWebLogic.sh)使配置生效。适合需要批量或脚本化管理的场景,通过WLST(WebLogic Scripting Tool)命令修改:
username、password、IP、端口):java weblogic.WLST
connect('username', 'password', 't3://<服务器IP>:7001')
Log节点,使用setLogLevels命令设置级别(如将AdminServer日志级别设为INFO):cd('/Servers/AdminServer/Log/AdminServer')
setLogLevels('INFO')
save()
activate()
exit()退出脚本。FINEST),记录的日志信息越详细(适合排查问题);级别越高(如SEVERE),记录的信息越简略(适合生产环境)。logging.xml文件的配置优先级最高。以上方法覆盖了CentOS环境下WebLogic日志级别调整的主要场景,可根据实际需求选择合适的方式。