Questions tagged [filehandler]

File handlers are mechanisms which provide abstraction over primitive file operations.

File handlers are modules (e.g. classes) which wrap primitive file operations (e.g. read, write) and file system operations (e.g. unlink, move, file watching) in helpful abstractions for specific usage scenarios.

For example, a file handler implemented as a class in opens a file in the format, reads each entry, and populates a list of row objects. In this case, the file handler has wrapped the open and read calls so the the caller need only know the name of the file.

Questions relating to the development of custom file handlers should include this tag. Additionally, questions which involve the use of standard or third-party file handlers may also include this tag.

See also:

147 questions
3
votes
1 answer

When to close and remove FileHandler with java logging

I am using the java.util.logging API and atatching several FileHandlers to a named logger to write the log messages to specific files. I see that this creates a lck (lock) file for each log file. The lock file is deleted when I close and remove the…
edwardborner
  • 227
  • 3
  • 10
3
votes
0 answers

FileHandle causing memory leak in iOS

The background I am working on a project which uses a third party SDK to process files in a particular format. The SDK takes Data as parameter to process. In case of large files, since iOS Data object doesn't support buffered reading, the SDK also…
Harikrishnan
  • 7,765
  • 13
  • 62
  • 113
3
votes
2 answers

How to determine if two handles refer to the same file

I would like to check if two file handles refer to the same file. In order to do this, can I use the stat function applied to each file handle? Thanks in advance my $file = 'C:\temp\file.txt'); open( TXT1, "> $file" ); open( TXT2, "> $file"…
fabrizio
  • 43
  • 1
  • 4
3
votes
1 answer

Python 3 logger with RotatingFileHandler excedes maxBytes limit

I am using the following code to limit the size of a logfile (minimal example): import logging from logging.handlers import RotatingFileHandler # Set up logfile and message logging. logger =…
msg
  • 315
  • 2
  • 3
  • 12
3
votes
0 answers

TimedRotatingFileHandler doesn't create a correct backup after rotating

I need a logger creating a new log file for every day, so I am using a TimedRotatingFileHandler and let it rotate at midnight. But every time it rotates, only the first logging message after midnight is stored in the backup file. The old log is…
no0by5
  • 632
  • 3
  • 8
  • 30
3
votes
0 answers

Node.js - find shell icon by file type (windows)

In node JS, for a display of files, I would like to get the icon windows will use for a file. Similarly to how chrome will show the correct icon considering the local handler. For example, when downloading a .psd file, when Photoshop is installed…
Selfish
  • 6,023
  • 4
  • 44
  • 63
3
votes
1 answer

How to call a system file selection dialog using perl on windows?

I know many perl based gui module would do that easily but I am curious about methods other than Prima or Tk etc. I want to call this dialog (Exactly looking as Windows Explorer) for a command line package. Is anything similar to system(''); command…
3
votes
2 answers

File handles not working properly in Perl

I tried initializing two file handles to NULL and later use it in my program. This was my code: my $fh1 = " "; my $fh2 = " "; open($fh1, ">", $fname1); open($fh2, ">", $fname2); print $fh1 "HI this is fh1"; After executing, my files contained…
user2775241
  • 119
  • 3
  • 12
3
votes
1 answer

How to create directories for Logger files through FileHandler

I am trying to create logs in directories where each directories are created day wise, but fileHandler is not creating directories rather its throwing exception Couldn't get lock for C:\dir_date\Logging.txt (here dir_date is not present and i am…
Shashank Vivek
  • 16,888
  • 8
  • 62
  • 104
2
votes
2 answers

Perl set file handle based on command line args

I want to read from the default input if data is piped in or a file is provided, but if nothing is given I would like to supply a default for while(<>) to execute on. Pseudocode: if(!<>){ <> = system("ls |…
Chris
  • 11,819
  • 19
  • 91
  • 145
2
votes
0 answers

Python - reinitiating logging file handler after logfile unavailable

I have been given a requirement to log a python application that runs continuously, to a logfile on an SMB share. The issue is if there is ever a reason for that SMB share to go offline (patching/network issue etc) whilst the python app is still…
R3uben
  • 105
  • 10
2
votes
0 answers

Discrepancy in FileHandler in OneDrive Shared Library for office extensions

When a FileHandler is deployed. When we click on the filename in OneDrive Shared Library either all the office extension should open in microsoft application or all the office extension should open via FileHandler (If configured for those…
Ivan
  • 21
  • 1
2
votes
1 answer

FileHandler creation gives NoSuchFileException cause missing .lck

im searching for 2 hours now fo a solution to this: Im trying to add a FileHandler to a Logger in a JAR. The Log-Directory is outside. In my IDE (NetBeans) this works: public static void addFileHandler(Logger logger) { try { Path…
Schesam
  • 583
  • 5
  • 19
2
votes
1 answer

Python logger confusion

I am trying to understand the python logging, and I have this: Main.py: import logging from Foo import Foo logging.basicConfig(level=logging.DEBUG) fh_formatter = logging.Formatter('[%(asctime)s : %(levelname)s : %(name)s] :…
Ufder
  • 527
  • 4
  • 20
2
votes
2 answers

java util logging configure filter in properties file

I have a maven project where I have written a java.util.logging filter as below. package com.xyz.filters; import java.util.logging.Filter; import java.util.logging.LogRecord; class CustomFilter implements Filter { public boolean…
Asma Zinneera Jabir
  • 801
  • 3
  • 13
  • 31
1
2
3
9 10