Log processing method written by asp

Source: Internet
Author: User
I. Implementation method
A log writing function provides several parameters. You can use this function to record logs. Logs are recorded in the xml file. The log file is generated by date. A new log file is created every day. The file name is yyyy_mm_dd.xml, which uses the year, month, and day. It is also easy to view logs. You only need to call the xml file directly if you want to view the logs. Because the xml file already has an xsl file by default to format the output.
II. Method for writing logs in books
'Logging program
'Author: Snow in Sebei
'Date: 2004.11.20
'Username: user information (indicating the person who performs the operation)
'Operate: indicates the operation performed by the user)
'Userip: User IP address (indicating the IP address of the computer used to log on to the system)
'Opdate: the date on which a user operation occurred
'The Log is written into an xml file. If the xml file does not exist during the first write, it is created.
'Return value: 1 indicates an error occurred while opening the log file
'Return value: 9 indicates that the log file is written correctly.
 
 
Function WriteSysLog (sys_userid, sys_username, operate)
Dim op_username
If trim (sys_userid) = "" and trim (sys_username) = "" then
Op_username = "anonymous"
Else
Op_username = sys_userid & "/" & sys_username
End if
 
XmlPath = "/" & getRoot () & "/log/SysLog /"
XmlFile = replace (cstr (ConvertDate (date (), "-", "_") & ". xml"
RootNode = "syslog" 'name of the root node of the log file
LogFile = server. mappath (xmlPath & xmlFile) 'log file path
Set fso = server. CreateObject ("scripting. filesystemobject ")
 
'If the log file does not exist, create one and write the header information and root information.

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.