WebLogic Access Log Custom logs

Source: Internet
Author: User

Weblogic8, join in the first line of Access.log
such as custom class C_username
# ... x-c_username

weblogic9,10, set up HTTP access logs using extended log format
Login console-servers-adminserver (Admin)-logging-Select http-advanced-
where format Select Extended
Extended Logging Format fields:x-c_username Date time cs-method cs-uri sc-status bytes cs (Referer) CS (user-agent) CS (COO Kie)

Code implementation:
Import weblogic.servlet.logging.*; public class C_username implements Customelflogger {public c_username () {} public void Logfield (Httpaccountinginfo httpa Ccountinginfo, Formatstringbuffer formatstringbuffer) {Formatstringbuffer.appendvalueordash ( Httpaccountinginfo.getremoteuser ()); } }

Reference:
weblogic.servlet.logging
Interface Customelflogger


This is a interface which allows customers to add custom information to the Extendedlogformat. They'll is responsible for implementing Logfield (Httpaccountinginfo metrics) method. ELF allows users to the Specify fields to is logged with each HTTP request. One of these #Fields are an application specific field in the form of X-somefieldname WLS expects a fully qualified Classna Me as the argument for this field and attempts to instantiate a instance of this class. Customers are responsible for following formatting guidlines of the specification. For example if they with one class to return two fields then they need to delimit them via a tab see:http://www.w3.org/tr/ Wd-logfile-960221.html for the "specification Also they should use caution as" API provides them the opportunity to do Anthying they want basically and they should not doing something that would inordinantly slow the system down. Like looking something up in the dmbs, or doing signigicant IO or networking

Key classes:
Weblogic.servlet.logging.LogManagerHttp
Weblogic.servlet.logging.ELFLogger
Weblogic.servlet.logging.CLFLoggerLogFormat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.