473,668 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logfile

Hello,

is anyone willing to help me out to setup a logfile.
I have a program running in Access, but I want to know the progress of
it.
It is rather easy I think, but don't know how to handle it.
Basicly, I run macros and I just want to write a message to a file
before and after the run of that macro.
eg:

Write Date(), Time(),"Start" & "message 1" to logfile.txt
run macro1
Write Date(), Time(),"Stop" & "message 1" to logfile.txt
Write Date(), Time(),"Start" & "message 2" to logfile.txt
run macro2
Write Date(), Time(),"Stop" & "message 2" to logfile.txt
Write Date(), Time(),"Start" & "message 3" to logfile.txt
run macro3
Write Date(), Time(),"Stop" & "message 3" to logfile.txt
Who can help me out? Tnx.

Oct 5 '06 #1
6 6881
ro************* **@gmail.com wrote:
Hello,

is anyone willing to help me out to setup a logfile.
I have a program running in Access, but I want to know the progress of
it.
It is rather easy I think, but don't know how to handle it.
Basicly, I run macros and I just want to write a message to a file
before and after the run of that macro.
eg:

Write Date(), Time(),"Start" & "message 1" to logfile.txt
run macro1
Write Date(), Time(),"Stop" & "message 1" to logfile.txt
Write Date(), Time(),"Start" & "message 2" to logfile.txt
run macro2
Write Date(), Time(),"Stop" & "message 2" to logfile.txt
Write Date(), Time(),"Start" & "message 3" to logfile.txt
run macro3
Write Date(), Time(),"Stop" & "message 3" to logfile.txt
Who can help me out? Tnx.
Some code straight out of help.

Open "TESTFILE" For Output As #1 ' Open file for output.
Print #1, "This is a test" ' Print text to file.
Print #1, ' Print blank line to file.
Print #1, "Zone 1"; Tab ; "Zone 2" ' Print in two print zones.
Print #1, "Hello" ; " " ; "World" ' Separate strings with space.
Print #1, Spc(5) ; "5 leading spaces " ' Print five leading spaces.
Print #1, Tab(10) ; "Hello" ' Print word at column 10.

' Assign Boolean, Date, Null and Error values.
Dim MyBool, MyDate, MyNull, MyError
MyBool = False : MyDate = #February 12, 1969# : MyNull = Null
MyError = CVErr(32767)
' True, False, Null, and Error are translated using locale settings of
' your system. Date literals are written using standard short date
' format.
Print #1, MyBool ; " is a Boolean value"
Print #1, MyDate ; " is a date"
Print #1, MyNull ; " is a null value"

Print #1, MyError ; " is an error value"
Close #1 ' Close file.
Oct 5 '06 #2

maybe I didn't expressed well what I had in mind.
The issue is that I just want to find a way to fill up the log file
with messages generated as the process flows.
Every time I think it is necessary (predefined positions), I would like
to write to the log file by activating a procedure that just needs the
name of the process and some text as parameter; something like: Run
logging, "Message 1".
In the procedure the message is written to the logfile and added with a
Date and Time.

Can this be done easily?

Oct 5 '06 #3
ro************* **@gmail.com wrote:
maybe I didn't expressed well what I had in mind.
The issue is that I just want to find a way to fill up the log file
with messages generated as the process flows.
Every time I think it is necessary (predefined positions), I would like
to write to the log file by activating a procedure that just needs the
name of the process and some text as parameter; something like: Run
logging, "Message 1".
In the procedure the message is written to the logfile and added with a
Date and Time.

Can this be done easily?
You asked how to send some text to write to a log file.

I provided an example. I recommend you run it. See the results.

It can be done easily.

You did not understand the code provided.

The question is...can you program?

Also, look at RunCode in help.

Oct 5 '06 #4
Dear Salad,

indeed, I'm not a programmer at all. I used to write programs in Dbase.
There I had the possibillity to run a program with extra parameters.
Via this program, and parameters, similar to what your wrote out for
me, the result came as easy as you tell it so well.
The problem is, How can I activate the code in the module and where do
I write my parameter.

By the way, find some code I used in a form where the procedure runs on
the on load event.
This is working well but the question remain. How can I fill my
variable "logentry" from outside??

Option Compare Database
Dim StrPath As String

Private Sub Form_Load()
Dim fn As Integer
fn = FreeFile
StrPath = "I:\be\_agb\Agf aproj\Logistiek \WOS"
logentry = "Testing to write to the logfile"
Open StrPath & "\WOS_Logging.t xt" For Append As #fn
Write #fn, Now & ": " & logentry
Close #fn

End Sub
salad schreef:
salad schreef:
ro************* **@gmail.com wrote:
maybe I didn't expressed well what I had in mind.
The issue is that I just want to find a way to fill up the log file
with messages generated as the process flows.
Every time I think it is necessary (predefined positions), I would like
to write to the log file by activating a procedure that just needs the
name of the process and some text as parameter; something like: Run
logging, "Message 1".
In the procedure the message is written to the logfile and added with a
Date and Time.

Can this be done easily?
You asked how to send some text to write to a log file.

I provided an example. I recommend you run it. See the results.

It can be done easily.

You did not understand the code provided.

The question is...can you program?

Also, look at RunCode in help.
Oct 5 '06 #5
ro************* **@gmail.com wrote:
Dear Salad,

indeed, I'm not a programmer at all. I used to write programs in Dbase.
There I had the possibillity to run a program with extra parameters.
Via this program, and parameters, similar to what your wrote out for
me, the result came as easy as you tell it so well.
The problem is, How can I activate the code in the module and where do
I write my parameter.
See code below. Hmmm...oftentim es you exectute an action by pressing on
a command button...or some other event that you want to start the process.

If you are using a macro, and a command button, in the OnClick event
enter the name of the Macro. Or use VBA.

DoCmd.RunMacro "Macro1"

>
By the way, find some code I used in a form where the procedure runs on
the on load event.
This is working well but the question remain. How can I fill my
variable "logentry" from outside??
Oftentimes you declare a field on a form (you can make invisible if you
don't want it seen). Then
Write #fn, Now & ": " & Me.logentry

Or maybe you declared the variable as public under the Option Explicit
line at the top of the code module.

Option Compare Database
Option Explicit
Dim logentry as String

What/when you assign to logentry is up to you.

Option Compare Database
Dim StrPath As String

Private Sub Form_Load()
Dim fn As Integer
fn = FreeFile
StrPath = "I:\be\_agb\Agf aproj\Logistiek \WOS"
logentry = "Testing to write to the logfile"
Open StrPath & "\WOS_Logging.t xt" For Append As #fn
Write #fn, Now & ": " & logentry
Close #fn

End Sub
What I might do is:
Open up a code module. Make a public sub that gets a message. Ex:
Public Sub WriteLog(strMsg As String, blnBlank As Boolean)
Open "LogFile" For Output As #1 ' Open file for output.
'print the message
Print #1, Date(); Tab ; Time() ; Tab ; _
IIF(Not blnBlank,"Start ","End ") & strMsg
'if this is the stop line, print a blank line
If blnBlank then Print #1,
Close #1 ' Close file.
End Sub

I am assuming you are using macros.
Now, in your macro, you call this code with RunCode. Or use VBA from
above to call WriteLog and then the macro
'Write Date(), Time(),"Start" & "message 1" to logfile.txt
Runcode WriteLog("Messa ge 1",False)

run macro1

'Write Date(), Time(),"Stop" & "message 1" to logfile.txt
Runcode WriteLog("Messa ge 1",True)

'Write Date(), Time(),"Start" & "message 2" to logfile.txt
Runcode WriteLog("Messa ge 2",False)
etc

Not sure what message you pass to the routine via RunCode. You might be
better off just writing the whole thing in VBA. Like
Private Sub Command1_Click( )
'uses routing blow this code block
WriteLog "Message variable", False
Docmd.RunMacro "Macro1"
WriteLog "Message variable", True
....
End Sub


>

salad schreef:
salad schreef:

>>ro*********** ****@gmail.com wrote:

>>>maybe I didn't expressed well what I had in mind.
The issue is that I just want to find a way to fill up the log file
with messages generated as the process flows.
Every time I think it is necessary (predefined positions), I would like
to write to the log file by activating a procedure that just needs the
name of the process and some text as parameter; something like: Run
logging, "Message 1".
In the procedure the message is written to the logfile and added with a
Date and Time.

Can this be done easily?

You asked how to send some text to write to a log file.

I provided an example. I recommend you run it. See the results.

It can be done easily.

You did not understand the code provided.

The question is...can you program?

Also, look at RunCode in help.

Oct 5 '06 #6
Dear Salad,

now you are writing real stuff; thank you very much.
The last part, to write the hole thing in VBA seems to me the most
apropriate.

Again, thank you for the advise and the attention to my problem.

Good luck, Roger
What I might do is:
Open up a code module. Make a public sub that gets a message. Ex:
Public Sub WriteLog(strMsg As String, blnBlank As Boolean)
Open "LogFile" For Output As #1 ' Open file for output.
'print the message
Print #1, Date(); Tab ; Time() ; Tab ; _
IIF(Not blnBlank,"Start ","End ") & strMsg
'if this is the stop line, print a blank line
If blnBlank then Print #1,
Close #1 ' Close file.
End Sub

I am assuming you are using macros.
Now, in your macro, you call this code with RunCode. Or use VBA from
above to call WriteLog and then the macro
'Write Date(), Time(),"Start" & "message 1" to logfile.txt
Runcode WriteLog("Messa ge 1",False)

run macro1

'Write Date(), Time(),"Stop" & "message 1" to logfile.txt
Runcode WriteLog("Messa ge 1",True)

'Write Date(), Time(),"Start" & "message 2" to logfile.txt
Runcode WriteLog("Messa ge 2",False)
etc

Not sure what message you pass to the routine via RunCode. You might be
better off just writing the whole thing in VBA. Like
Private Sub Command1_Click( )
'uses routing blow this code block
WriteLog "Message variable", False
Docmd.RunMacro "Macro1"
WriteLog "Message variable", True
....
End Sub
Oct 6 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1749
by: Leader | last post by:
Hi, I want to take backup of database logfile periodically and automatically. What should i do then..... Thanks Hoque
0
1792
by: guf | last post by:
Hi All, I have SQL Server 2000 sp3, Windows 2000 Server. I have a database which is used by an application server. I do several important jobs a day in the application server and never access my database directly. Those jobs are created through the application server API and I do not have access to the Application server procedure. My database is 500 Mo.
1
3190
by: FJ | last post by:
Hi all, I hope someone can help me with the following: I want my database to make a logfile in which it puts the date and time a code is used. The code is triggered by a timer. Every x mins it checks something and I want to write the time and date it checks into that logfile. So far I have only been able to make it a new file each time, but I
3
2233
by: ZoombyWoof | last post by:
HI all. I would like the same behaviour on the Microsoft Firewall logfile that you have on logfiles under unixes, you can make them rotate so that once a week or once a day the system renames the logfile to 'name'.1 and creates a new one. How can I do this from C# ? I have looked in the help about ServiceController, and I made a few testprograms that can show me the running services on the system, but I
2
1828
by: ge_orgy | last post by:
Accidently, I(we) deleted the Logfile.LDF in sysfiles folder on the mssql server and now can't enter the database, which status now is set SUSPECT. Before deleting the logfile I did a Transaction-Logfile Backup and there is maybe an older version of full database backup somewhere. Trying to restore database with enterprise manager, restoring from the Transaction Logfile Backup, enterprise manager tells me: 'The preceding restore...
2
3172
by: Andi Clemens | last post by:
Hi, we had some problems in the last weeks with our mailserver. Some messages were not delivered and we wanted to know why. But looking through the logfile is a time consuming process. So I wanted to write a parser to analyse the logs and parse them as XML. But I have never written a parser before and know I'm sitting in front of the logfile trying to write the grammar for pyparsing.
0
1392
by: indiarocks | last post by:
Is there a way in which the all the logging done using pexpect can be sent to stdout as well as a file. eg. filea = file('output.log',"w") ssh = pexpect.spawn('ssh root@1.1.1.1') ssh.logfile = filea ssh.expect('*assword',timeout=5) ...... In the above script, the output would be stored only in the logfile, is there a way in which it can be even be sent to sys.stdout at the same time.
0
1521
by: Adam | last post by:
Hello, I have a small app I am creating to crawl a directory and check that if it is moved to another a location it's path will not break a character limit. Usually the Windows path limit. Now the script is working but every time I want to scan again I have to restart for the log files to be written. I want to just be able to change the parameter as I please and click scan without having to restart the app for the log file to change.
2
2870
by: pompom | last post by:
hello all! i have to make a project for school , making a newsserver and a client. the thing is, i send messages between them to let the user know if everything is running ok. just some simple http messages as 201, etc. as a extention id like to build in a log file maker. what i want is: everything that is put on the output stream will also appear in a logfile. i already found this:
0
8381
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8583
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8656
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7401
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4205
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4380
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2791
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1786
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.