How to get the logs in XML file in cleartool. I want the output of command cleartool lshistory in XML file

149 views Asked by At

I am trying command cleartool lshistory > file.txt through this I am getting the file in text format similarly I want the log file in XML format.

1

There are 1 answers

9
VonC On BEST ANSWER

cleartool lshistory doesn't offer xml output.

You would need to parse its output, and generate the expected xml yourself.

akshay jain asks in the comments:

how we can get the logs in well formatted way so I can parse it easily and store the values in db?

Using fmt_ccase, you can control exactly the ouput you want, for better parsing (as in this example):

cleartool lshistory -fmt "Element: %n| Date: %d| User:%u| Operation: %e| Object:%[type]p| SimpleType: %m| OperationKind: %o\n" -all /vobs/vob_name

The OP adds:

I want the version changes logs only not other logs, is there any way?

I mentions %c (comment message), but:

Is there a way to handle the %c output, because it is disturbing the format of log file?

I then mention %Nc, which avoid appending newlines at the end of the comment message.

The OP confirms in the chat:

%Nc works thanks