I have a small VB.NET application that captures left clicks, right clicks
and key presses and automatically logs them to a csv file every 1 minute.
The issue is that if I want to look at the log file, I get an error because
the app is trying to write to the log file and it is open.
How can I circumvent this issue?
Thanks,
Drew 7 1258
When you look at the log file, are you opening it for read or for write?
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> escribió en el mensaje
news:Oy******** ******@TK2MSFTN GP10.phx.gbl... I have a small VB.NET application that captures left clicks, right clicks and key presses and automatically logs them to a csv file every 1 minute. The issue is that if I want to look at the log file, I get an error because the app is trying to write to the log file and it is open.
How can I circumvent this issue?
Thanks, Drew
I am opening it in Notepad, so I guess that I am opening it for writing...
How should I review this log while the program is running?
Do you want me to post all the code?
Thanks,
Drew
"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAM sogecable.com> wrote in message
news:eQ******** ******@TK2MSFTN GP10.phx.gbl... When you look at the log file, are you opening it for read or for write?
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA You can code, design and document much faster. Free resources for add-in developers: http://www.mztools.com
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> escribió en el mensaje news:Oy******** ******@TK2MSFTN GP10.phx.gbl...I have a small VB.NET application that captures left clicks, right clicks and key presses and automatically logs them to a csv file every 1 minute. The issue is that if I want to look at the log file, I get an error because the app is trying to write to the log file and it is open.
How can I circumvent this issue?
Thanks, Drew
Hello Drew,
How are you doing?
Two ways to get out of this problem:
1) Copy the file and then open the copied file.
2) Create your own File reader in which you open a connection to the text
file in a ReadOnly mode.
And for this open a filestream instead. You can pass
System.IO.FileA ccess.Read to the constructor.
Then you can create a new streamreader to read from the stream.
I hope this is helpful.
Thanks
Mona
[Grapecity]
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> wrote in message
news:Oy******** ******@TK2MSFTN GP10.phx.gbl... I have a small VB.NET application that captures left clicks, right clicks and key presses and automatically logs them to a csv file every 1 minute. The issue is that if I want to look at the log file, I get an error
because the app is trying to write to the log file and it is open.
How can I circumvent this issue?
Thanks, Drew
Basically, you should not open the file to view it with an *editor*, which
by definition will open the file for write. If you don´t find a tool that
can open a file to view it with read-only access, you can build your own.
The .NET framework has functions to open streams for read-only access. See
the docs about the Stream and derived classes.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers: http://www.mztools.com
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> escribió en el mensaje
news:OZ******** *****@TK2MSFTNG P10.phx.gbl... I am opening it in Notepad, so I guess that I am opening it for writing... How should I review this log while the program is running?
Do you want me to post all the code?
Thanks, Drew
Thank you for your reply. I will check out the functions that you mentioned
and see what I can do.
Thanks,
Drew
"Carlos J. Quintero [VB MVP]" <ca*****@NOSPAM sogecable.com> wrote in message
news:O8******** ******@TK2MSFTN GP14.phx.gbl... Basically, you should not open the file to view it with an *editor*, which by definition will open the file for write. If you don´t find a tool that can open a file to view it with read-only access, you can build your own. The .NET framework has functions to open streams for read-only access. See the docs about the Stream and derived classes.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA You can code, design and document much faster. Free resources for add-in developers: http://www.mztools.com
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> escribió en el mensaje news:OZ******** *****@TK2MSFTNG P10.phx.gbl...I am opening it in Notepad, so I guess that I am opening it for writing... How should I review this log while the program is running?
Do you want me to post all the code?
Thanks, Drew
Thanks for your reply Mona, I will check out the suggested options and see
what I can find.
Thanks,
Drew
"Mona" <mo**@discussio ns.com> wrote in message
news:ur******** ******@TK2MSFTN GP12.phx.gbl... Hello Drew,
How are you doing?
Two ways to get out of this problem: 1) Copy the file and then open the copied file. 2) Create your own File reader in which you open a connection to the text file in a ReadOnly mode. And for this open a filestream instead. You can pass System.IO.FileA ccess.Read to the constructor. Then you can create a new streamreader to read from the stream.
I hope this is helpful.
Thanks Mona [Grapecity]
"Drew" <dr********@NOs wvtc.dmhmrsas.v irginia.SPMgov> wrote in message news:Oy******** ******@TK2MSFTN GP10.phx.gbl... I have a small VB.NET application that captures left clicks, right clicks and key presses and automatically logs them to a csv file every 1 minute. The issue is that if I want to look at the log file, I get an error because the app is trying to write to the log file and it is open.
How can I circumvent this issue?
Thanks, Drew
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: j vickroy |
last post by:
Hello,
I'm trying to understand the behavior of the Python 2.3 logging module (MS
Windows 2k) with regard to RotatingFileHandler. The following script
illustrates a puzzling problem. What is wrong with this script?
Thanks,
-- jv
|
by: qwweeeit |
last post by:
Hi all,
I wonder if it is possible to change (temporarily) a built-in function
for logging purposes.
Let me explain:
I want to log all the 'open' operations, recording the file to be
opened, the "mode" (r/w/a...) and (possibly) the module which made the
call.
After that the 'open' can carry on following the standard built-in
path.
Possibly I don't want to have to modify the source of the application
|
by: JT |
last post by:
i have a text file that is used as a logfile for easier debugging. i am
using the OpenTextFile method to write to this file. this method exists
inside a logging function that can be called from anywhere in my ASP. this
works great for our development system b/c we have a limited number of
users.
however, we're unable to use this logging mechanism on live due to
concurrency issues. when two users attempt to open and write to the text...
|
by: Joe Bloggs |
last post by:
Hi all,
I take the pleasure to inform that Dotnet Commons Logging has been released
for use.
Dotnet Commons Logging, a subproject of the Donet Commons project currently
located under the GotDotNet Workspace, has been released as an individual
package.
Dotnet Commons Logging provides a unified Log interface that acts as a
|
by: Ollie Riches |
last post by:
I am trying to use asynchronous logging using MSMQ and I have configured the
properties as defined in the help (see below) I don't understand where the
property 'MsmqPath' is in the app.config for MSMQDistrbutor.exe is it meant
to be an aplication settings or an enterprise library setting in the
app.config?
I have tried creating an application setting value for it but it still fails
to write to the logging destination?
Also is this...
| |
by: Jed Parsons |
last post by:
Hi,
I'm using the logging module for the first time. I'm using it from
within Zope Extensions.
My problem is that, for every event logged, the logger is producing
multiple identical entries with the timestamp the same down to the
millisecond.
Is this something I'm doing wrong?
|
by: cj |
last post by:
I'd like some advise on a fool proof logging system. I have a windows
app and need key events to be logged to a text file. Here are the
REQUIREMENTS I have been given--generally requirements I'm given are
non-negotiable.
--It might be hours or days between logging events or just split seconds.
--This application will be run from a network drive and the log file
will reside in the directory it is run from.
|
by: Leo Breebaart |
last post by:
I have another question where I am not so much looking for a
solution but rather hoping to get some feedback on *which*
solutions people here consider good Pythonic ways to approach a
issue.
The situation is this: I am writing fairly large console scripts
in Python. They have quite a few command-line options, which lead
to configuration variables that are needed all over the program
(e.g. the "--verbose" option alone is used by just...
|
by: Christoph Haas |
last post by:
Evening,
I have an application that is running in an endless loop processing an
incoming queue. Every run is supposed to write a log file about the run
and then close it again. While the 'logging' module is generally working
well (even though the documentation makes me miss some proper examples
how everything works together) I can't seem to close the log file again
to open a new one.
This is basically what I'm doing:
|
by: evenrik |
last post by:
An a redhat box I have root, apache and other normal users run code
that uses the logging module to write to the same log file. Since
umasks are set to 2 or 022 this gets permission errors.
I have fixed my issue by patching the logging code everywhere there is
an open for write with:
try:
old_umask = os.umask(0)
# open for write here
finally:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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...
|
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...
|
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...
| |
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...
|
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...
| |