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
0
votes
1 answer

FileHandler generate extra logs files when original log is locked

I need generate one log file by each application installed and running on websphere application server 9. I use JUL for generate log's file. My solution was create a especific Class thas inherits from FileHandler and set logs properties by a config…
0
votes
0 answers

How to configure logger in decorator class in python

This is the code I was using: import logging class decorator_class(object): def __init__(self, original_function): self.original_function = original_function self.logger = logging.getLogger(original_function.__name__) …
0
votes
1 answer

Merge/Append two files

I have two files, File1 & File2. I want to append File2 at the end of File1. func writeToFile(content: String, fileName: String) { let contentToAppend = content+"\n" let filePath = NSHomeDirectory() + "/Documents/" + fileName //Check…
iUser
  • 1,075
  • 3
  • 20
  • 49
0
votes
1 answer

Accessing file using fileget url

I am trying to create file handler add in that uses provider hosted application to open custom file. I have hosted app in heroku and until now i get request body in my application as follows when i open file from sharepoint. { resourceid:…
duwalanise
  • 1,312
  • 1
  • 14
  • 24
0
votes
3 answers

In Python, how to use a file for writing bytes in it and reading as text

I would like to save bytes to a file and then read that file as a text. Can I do it with one with? What should I use, wb, r or wbr? myBytesVar = b'line1\nline2' with open('myFile.txt', 'wb') as fw: fw.write(myBytesVar) with open('myFile.txt',…
Hrvoje T
  • 3,365
  • 4
  • 28
  • 41
0
votes
0 answers

Can i print return array data without any handler file in ajax?

Ajax gets return array data and prints the particular position to print out with a foreach loop. But without any third file, it is possible? I have all array data in the third file and all data to return an ajax and print that id through in php…
Dilip Solanki
  • 437
  • 3
  • 13
0
votes
1 answer

Watching a directory for file changes with Python does not work

I used this http://brunorocha.org/python/watching-a-directory-for-file-changes-with-python.html example for resolving of this task. And it worked. When i have not used OOP. Now, i am trying to rewrite my code to OOP, what i did: I created file with…
Piduna
  • 609
  • 12
  • 28
0
votes
2 answers

How to avoid and controll the increment of files app.log.X in JAVA LOGGIN

I am fighting with some thing from yesterday. I want to log a webapp (WAR) in java. I create a log, append a FileHandler, and i send log messages. But, like all of us know, the file handler keep the lock over the new file until i call fush() and…
Joaquin
  • 47
  • 1
  • 5
0
votes
2 answers

Java Logger wont log into file

I can't make my logger to work. Inside my code I have these lines : private static final Logger log = Logger.getLogger(ServerThread.class.getName()); log.setUseParentHandlers(false); FileHandler fh = new FileHandler("ex.txt", true); SimpleFormatter…
Vladislav S
  • 21
  • 1
  • 9
0
votes
2 answers

logger configuration to log to file

Python newbie. Now I have been stuck around this for a while. When I try to write logs in a file using ini configuration nothing is captured in the file. I tried to debug the problem but couldn't get any clue. Writing logs without using ini file…
qwerty
  • 2,392
  • 3
  • 30
  • 55
0
votes
0 answers

Logger for long running python code - Can I use it to monitor status of execution

I have a very long running python code that calls multiple api's. I have also implemented logger at each step to identify the exceptions. But, the FileHandler shows the data only on completion of the python script. Is there a way to flush the logger…
ForeverLearner
  • 1,901
  • 2
  • 28
  • 51
0
votes
1 answer

Reading a string char by char is very slow in my swift implementation

i have to read a file char by char in swift. The way I am doing it is to read a chunk from a FileHandler and returning the first character of a string. This is my code so far: /// Return next character, or nil on EOF. func nextChar() -> Character?…
Peter Shaw
  • 1,867
  • 1
  • 19
  • 32
0
votes
1 answer

Java FileHandler and rolling log files

I understand how the Java FileHandler rolls to the next log file when a particular size is reached. What I want is a little different. I want to use the FileHandler to use the log file with the oldest last written time in the sequence when the…
Brian McCormick
  • 449
  • 4
  • 5
0
votes
1 answer

is there any way to directly read Pandas dataframe as a file handler?

I used pandas to load data from a dataSource.cvs file: DF = pd.read_csv('dataSoruce.csv') In pandas I can clean the data, like filling missing values with 0. Next I use DF.to_csv('temp.csv', sep=',') to write the DF as a temporary cvs file, and…
TripleH
  • 447
  • 7
  • 16
0
votes
1 answer

java open files not cleaned, even when the process is killed

There is a java program which read files from a folder, do some processing and write output files in another folder. It ran for 4 hours and produced few files but then failed after throwing following error: "too many files" Then I modified the…
Shweta
  • 1,111
  • 3
  • 15
  • 30