ndt-dev - [ndt-dev] Date and time log format
Subject: NDT-DEV email list created
List archive
- 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: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.