Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] Date and time log format

Subject: NDT-DEV email list created

List archive

[ndt-dev] Date and time log format


Chronological Thread 
  • From: Дмитрий Коржевин <>
  • To:
  • Subject: [ndt-dev] Date and time log format
  • Date: Fri, 6 Nov 2015 18:31:55 +0200

Hi,

Can you please advice - which source file of web100srv should I edit, to slightly change time and date format, that are written to log file:

Now I use next simple script to convert date:
import datetime
import sys

log_path = sys.argv [1]
new_log = log_path + '-formated'

with open(log_path) as f:
    content = f.readlines()


f2 = open(new_log,'w')
for line in content:
	splitted = line.split (',')
	if len(splitted) > 30:
		date = datetime.datetime.strptime(splitted[0], '%b  %d %H:%M:%S')
		year = datetime.datetime.now()
		formated = str(year.year) + date.strftime('-%m-%dT%H:%M:%S.000+00')
		splitted[0] = formated
		newline = ','.join(splitted)
		f2.write (newline)

f2.close	


Thank you

Dmitry



  • [ndt-dev] Date and time log format, Дмитрий Коржевин, 11/06/2015

Archive powered by MHonArc 2.6.16.

Top of Page