473,413 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Inser Date & Time to a logfile

Hi Guys,

Complete newbvie here, trying to get an answer to my problem.

I have written small client / server applications, in which everything that the server does is recorded in a logfile using the MY.Computer.Filesystem string.
I can write the statement to the file and create a new liine for example.

Server Activity - Server Started
Client Activity
Client Activity - User Smith has succesfully logged in
Client Activity - User Smith has logged off
Server Activity - Server Shutdown.

I want to add the date and time of each event before the activity statment line

TIA
Dec 7 '06 #1
3 1313
sashi
1,754 Expert 1GB
Hi Guys,

Complete newbvie here, trying to get an answer to my problem.

I have written small client / server applications, in which everything that the server does is recorded in a logfile using the MY.Computer.Filesystem string.
I can write the statement to the file and create a new liine for example.

Server Activity - Server Started
Client Activity
Client Activity - User Smith has succesfully logged in
Client Activity - User Smith has logged off
Server Activity - Server Shutdown.

I want to add the date and time of each event before the activity statment line

TIA
Hi there,

Kindly include the below code segment to begining of the activity statement, hope it helps. Good luck & Take care.

Expand|Select|Wrap|Line Numbers
  1.   Now() & "..your activity statement line.."
  2.  
Dec 7 '06 #2
Sorry, for late reply, but just back from UNI. Worked a treat. Thanks

I've only been doing VB.Net for 6 weeks and hve no real programming skills at all (I am a network man at heart!!)

One last thing, I am atempting to output the contents of a txt file in a display box. The file when open in windows lokos like this

01/01/01 00:00 SERVER ACTIVITY - Server Started
01/01/01 00:00 CLIENT ACTIVITY - User SMITH has logged on
etc
etc

Yet when it displays in the lsbox (named lsLog), there are no carriage returns and all the data is in one very long line.

Code

Private Sub btShowlog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btShowlog.Click
Dim fileContents As String
lsLog.Visible = True
lsLog.Items.Clear()
btcloselog.Visible = True
fileContents = My.Computer.FileSystem.ReadAllText(File_Path & "atmlog.txt")
lsLog.Items.Add(fileContents)
End Sub

Again any help would be greatfully appreciated
Dec 7 '06 #3
Killer42
8,435 Expert 8TB
You might need to check the delimiters you have on the end of each line. The likely options are:
  • Carriage Return (CR)
  • Line Feed (LF)
  • Both CR & LF
A lot of languages/controls in the Windows world expect CRLF to delimit lines. You might need to either modify the way you write the lines to the file to produce the correct delimiter, or read it line by line to place it in your display field.

You might also want to check whether the control in which you're displaying the text has somethig equivalent to the VB6 textbox's MultiLine property, which determines whether it can show more than one line.
Dec 7 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Gerry | last post by:
As I'm not a PHP-prgrammer at all, I just need Help with this: I have had a guestbook-page in Europe and will now have to move it to a US based-server. This makes the time-function showing time...
1
by: Lynn.Tilby | last post by:
I am running an experimental system, my disk filled up when running a table build from a query. I mistakenly blew away the files in .../pgsql/data/base/18773 & ../pgsql/data/pg_xlog with NO BU!...
1
by: John | last post by:
Hi I am using and access datetime field to store both date & time. How can I split it into date & time after reading the field and then combine the date & time back into datetime when storing...
3
by: divya | last post by:
Hi, I have a table tblbwday with 2 fields Name and Birthday.I have written this script for displaying evryday names of the people on that day. <% set objConn...
1
by: aRTx | last post by:
<? /* Directory Listing Script - Version 2 ==================================== Script Author: Artani <artan_p@msn.com>. www.artxcenter.com REQUIREMENTS ============ This script requires...
1
by: adeebraza | last post by:
Hi, Every Body Following is code for Showing Actual Date & Time on the form and also record Date & Time of an event. See the following and use Call Modified when you want to record an event in...
2
by: alivip | last post by:
when I wont to inser (anyting I print) to the textbox it will not inser it just print then hanging # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, #...
3
by: aRTx | last post by:
I have try a couple of time but does not work for me My files everytime are sortet by NAME. I want to Sort my files by Date-desc. Can anyone help me to do it? The Script <? /* ORIGJINALI
3
by: santosh95808 | last post by:
Hi friends, I am finding some difficulties in the inserting date time into the database. I am not able to convert the datetime into the mysql's Date Time format i.e. 'yyyy/mm/dd hh:mm:ss' ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.