write to log file columns in vb

Hi All,

Having trouble writing to a logfile and getting the data to dispaly where I want.

What I want to acheive is:
 Untitled.png
But what Im getting is:
srv.png
....So my code isnt writing ot all the columns.
            Dim str As String = "<![LOG[" & message & "]LOG]!><time=""" & Now.ToLongTimeString & """" & " date=""" & Now.ToShortDateString & """ component=""" & component.ToString & """" & " type=""1""" & " Thread=""" & t & """" & ">"
            File.AppendAllText(logfile, str & vbCrLf)

Open in new window


...What Am I missing here ?
R555BAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Put a breakpoint on this line:
File.AppendAllText(logfile, str & vbCrLf)
and look at the contents of str.
0
R555BAuthor Commented:
I've stepped it through the debugger a couple of times...This is the first line that comes out:

"<![LOG[Server Started]LOG]!><time="18:21:32" date="25/02/2015" component="(Main:)" type="1" Thread="8">"

...As far as I can see all the quotes and brackets line up.
0
AndyAinscowFreelance programmer / ConsultantCommented:
That makes me think your posted code is fine - the problem is likely by the code you use to fill the grid display.
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

R555BAuthor Commented:
Managed to find some raw data from one of the existing log files on my system. I think maybe the columns are expecting the data to be in a certain format before it will display - As far as I can tell though there is no obvious way to determine what that format is.

I've now managed to get component and date time to appear properly using the following syntax:

Dim d As String = Now.Month & "-" & Now.Day & "-" & Now.Year
Dim str As String = "<![LOG[" & message & "]LOG]!><time=""" & Now.ToLongTimeString & "." & Now.Millisecond & "-60" & """" & " date=""" & d & """ component=""" & component.ToString & """" & " type=""1""" & " Thread=""" & t & """" & """ File=Me

Open in new window


Thread still isnt appearing properly but I think I can probably live with that
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>I think maybe the columns are expecting the data to be in a certain format before it will display - As far as I can tell though there is no obvious way to determine what that format is.

Is this some third party tool or something you don't have the code / documentation for?
0
R555BAuthor Commented:
No - its just appending the text to a standard .log file. Just no way to know what it expects.
0
it_saigeDeveloperCommented:
Could you provide your method to read the data from the text file and display it in the grid?

-saige-
0
AndyAinscowFreelance programmer / ConsultantCommented:
>>No - its just appending the text to a standard .log file. Just no way to know what it expects.

To repeat myself:
Is this some third party tool or something you don't have the code / documentation for?
By that I meant the viewer that you are using to see the log file output.
0
R555BAuthor Commented:
viewer is cmtrace.exe
0
R555BAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for R555B's comment #a40631371

for the following reason:

Persevered and found the answer
0
AndyAinscowFreelance programmer / ConsultantCommented:
Please post just how you solved this or request a delete.
0
R555BAuthor Commented:
 Dim str As String = "<![LOG[++ " & message & "]LOG]!><time=""" & Now.ToLongTimeString & "." & Now.Millisecond & "-60" & """" & " date=""" & d & """ component=""" & component.ToString & """" & " type=""1" & """ Thread=""" & t & """ Severity=""" & sev & """ File=""Me"">"
            File.AppendAllText(logfile, str & vbCrLf)

Open in new window


Time had to be in a specific format
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.