You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WebLogic 12.1.2/12.2.1 HTTP扩展日志格式自定义配置问询

WebLogic HTTP Access Log: Switching to Key-Value Pair Format (12.1.2/12.2.1)

Absolutely, WebLogic versions 12.1.2 and 12.2.1 definitely support customizing your HTTP access logs into the key-value format you're looking for. Let's walk through exactly how to set this up:

Step 1: Confirm Extended Log Format is Enabled

Since you mentioned your current config already uses the "Extended" format, you're halfway there. Just double-check this is still selected in your server's HTTP log settings (we'll be modifying the extended fields next).

Step 2: Update the Extended Log Format String

Replace your current extended log format field string with this custom key-value formatted version:

date=date time=time method=cs-method uri=cs-uri status=sc-status duration=time-taken client_ip=c-ip

Breakdown of the Mapping

Each part maps directly to your original log fields, paired with your preferred key names:

  • date=date: Captures the request date (matches your original date field)
  • time=time: Captures the request time (matches your original time field)
  • method=cs-method: Maps the HTTP request method (GET/POST, original cs-method)
  • uri=cs-uri: Maps the requested URI path (original cs-uri)
  • status=sc-status: Maps the HTTP response status code (original sc-status)
  • duration=time-taken: Maps the request processing time (original time-taken)
  • client_ip=c-ip: Maps the client's IP address (original c-ip)

Step 3: Apply the Configuration

You can set this via either the WebLogic Console or directly in config.xml:

Option 1: WebLogic Console

  1. Log into your WebLogic Administration Console
  2. Navigate to Servers → Select your target server → Go to the Logging tab → HTTP Log sub-tab
  3. Ensure the Format dropdown is set to Extended
  4. Paste the custom format string into the Extended Log Format Fields text box
  5. Save your changes and restart the server to apply the new log format

Option 2: Edit config.xml Directly

  1. Locate the <access-log> block for your server in config.xml (usually in DOMAIN_HOME/config)
  2. Ensure format="extended" is set on the <access-log> element
  3. Add or update the <extended-log-format> child element with your custom string:
    <access-log>
      <file-name>access.log</file-name>
      <format>extended</format>
      <extended-log-format>date=date time=time method=cs-method uri=cs-uri status=sc-status duration=time-taken client_ip=c-ip</extended-log-format>
      <!-- Other existing configs -->
    </access-log>
    
  4. Save the file and restart the server

Step 4: Verify the New Format

After restarting, check your access.log file—you should see entries exactly like the sample you provided:

date=2018-01-18 time=11:39:19 method=GET uri=/test/service status=200 duration=1.406 client_ip=127.0.0.1
date=2018-01-18 time=11:39:19 method=POST uri=/test/service status=200 duration=0.169 client_ip=127.0.0.1

Quick Notes

  • Make sure you use the exact WebLogic field variables (like cs-method, sc-status) on the right side of the = sign—these are fixed identifiers WebLogic uses to populate log data.
  • A server restart is required for the new log format to take effect; WebLogic doesn't apply HTTP log config changes dynamically.

内容的提问来源于stack exchange,提问作者lichSkywalker

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:38:32