Sitemap

Amicuk Programming Answers

What is the best way to merge a file content into log file

2015-10-11   Views:0

Advertisement

What is the best way to merge a file content into log file. In worst case, I will read the file line by line as string, then use logger.info(lineString)to output to log file. However, is there better way to do this? The eventual log file will be some

What is the best way to merge a file content into log file.
In worst case, I will read the file line by line as string, then use
logger.info(lineString)to output to log file.
However, is there better way to do this?
The eventual log file will be something like:
log message 1
log message 2
content from file line 1
content from file line 2
content from file line 3
log message 3
log message 4Thanks

The replay answer
Advertisement
John618 wrote:
Thank you and let me explain:
1. What do you mean by better?
I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
Regardless of what you do you are still going to need to read the file.
>
2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
Any idea?How is it supposed to be part of it? For example which of the following is better?
        File AAA - contents
                   First Line
                   Second Line XXX
        Log 1
                2009-03-27 DEBUG: Random preceding line
                2009-03-27 DEBUG: First Line
                2009-03-27 DEBUG: Second Line XXX
                2009-03-27 DEBUG: Random following line
        Log 2
                2009-03-27 DEBUG: Random preceding line
                2009-03-27 DEBUG: ----- File: AAA -------------
                First Line
                Second Line XXX
                2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
The first can be created by reading one line at a time and posting one at a time.
The second can be created by reading the entire file as a single string and then posting using a single log statement.

Go to See the other 5 answers

Hyper-v VM - merged .avhd files - now cant start as missing .vsv file

Category:DefaultRelease time:2015-10-11Views:130

Hi All, Yesterday i shut down one of our VMs to allow the snapshots to merge and then tried to start the VM but got the following error: 'VM' could not initialize. An attempt to initialize VM save state failed. 'VM' could not initialize. (Virtual Mac[More]

How to merge pdf files into one pdf file?

Category:DefaultRelease time:2015-10-11Views:130

In E-Rec we need the capability to mass printing for correspondance. There i want to merge pdf files for candidates into one pdf file. I am doing the following: Data: lv_document1           TYPE rcf_s_cs_document_content. LOOP AT activity_object_tab[More]

Is there a simple way to merge mp3 files into one mp3 file:

Category:DefaultRelease time:2015-10-11Views:130

Is there a way to simply merge multiple mp3s into one? I have audacity; however, that program becomes cumbersome when merging multiple files. My thanks to anyone for help on this one.I have audacity; however, that program becomes cumbersome when merg[More]

I want to merge mp3 files into one file so i can play a mix in i tunes without pauze

Category:DefaultRelease time:2015-10-11Views:130

i want to merge mp3 files into one file so i can play a mix in i tunes without pauzeAudacity is what you need. Obviously you need to create a new MP3 file of the combined songs and not delete the originals. If your DJ-ing and/or just have too many so[More]

RoboHelp HTML Version 8 - Merging AIR files

Category:DefaultRelease time:2015-10-11Views:130

We use Webhelp Pro to merge 19 separate projects into a single merged help file. Can I do that with AIR output, and if so, how? Can anyone point me to a tutorial?Hi there! I agree with what both Pater and Rick have said, but there may be another way[More]

What is the best way to merge a file content into log file

Category:DefaultRelease time:2015-10-11Views:130

What is the best way to merge a file content into log file. In worst case, I will read the file line by line as string, then use logger.info(lineString)to output to log file. However, is there better way to do this? The eventual log file will be some[More]

Merging PDF Files in Preview 5 in OS X v10.7 Lion

Category:DefaultRelease time:2015-10-11Views:130

I recently updated to the OSX v10.7 Lion operating system.  In the previous version I had, I was able to merge two or more PDF files in Preview just by dragging the thumbnail.  However, in the Lion version, it is not allowing to drag one PDF file int[More]

Adobe Acrobat, Print multiple files to PDF and merge open files to closed files?

Category:DefaultRelease time:2015-10-11Views:130

I have Adobe Acrobat XI Professional. Print to PDF – How can this be done for more than 15 documents at a time?  Right now, if I select 16 or more documents, I cannot 'right click' and choose 'print'.  Is this a setting issue?  If I have many documen[More]

Merge/append the contents of a pdf file to an MS Word document in JAVA

Category:DefaultRelease time:2015-10-11Views:130

Hi experts, I have a requirement to merge/append the contents of a pdf file to an ms word document(Not to be done by including pdf file objects in word). Please suggest some java libraries or ways to do it using java. Any pointers would be appreciate[More]

Problem in Merging PDF files

Category:DefaultRelease time:2015-10-11Views:130

Need to print batches of PDF.<br />The command copy *.PDF > LPT1: (redirected by NET USE) doesn't work.<br />On the printer I get an error message. All files are sent in one file.<br />.<br />I guess this is related to the PDF h[More]

Issue with Merging two files in BPM

Category:DefaultRelease time:2015-10-11Views:130

Hi, I need to merge two files (Balance and transaction) with correlation is defined from ID, Date and Accountnumber.. Sometimes, when there are no transaction records, then balanace file will come up number "0" Balance file: MDk;1728;175;02.09.1[More]

Hot
Hi everyone I may just have a proper workaround for all you poor audio types like myself, trying to do post sound in logic. Firslty, let me say it helps if you have Protools (6.4 is fine) with digitranslator. I've been trying to import a 94 minute fe [More]
Hello! I'm Daniel from Brazil. I have been facing a problem recently to which I see no solution. I need to use a specific component called 'Panel Label and Message' in order to nest three other components which need to be grouped together to work pro [More]
Hi, I'm just working with POWLs resp. the associated feeder class. At the moment I have two question that hopefully could be answered by someone: 1) Is it possible to modify the UI layout of the selection criteria in a way that they will be displayed [More]
I have Samsung DVD burner. Well, what they call "Samsung". So I am having problem that When I eject the DVD after burning. It still spin very fast. I don't know it is because the failure of the DVD drive, or it is the driver's problem. any idea? [More]
Hi, I have a report which when the user clicks the execute button, a popup should display mentioning it to run the program in background mode. Please let me know how to achieve it. Regards Krishhi, at first you are right there are really LOTS of ways [More]
Hello everyone, We are developping a software that uses JDK. I would like to know if there will be any fees to give to SUN when we sell the software or if it's a just a contract. I would appreciate the advise of someone who sold a software using JDK [More]
In my procedure I convert a varchar input to a date as: lv_mydate := to_date(p_passed_date,'mm/dd/yyyy') The p_passed_date is a varchar type and lv_mydate is a date type Now, when I use this lv_mydate in my select query no rows are returned although [More]
Will Lightroom 4 ever support Nikon's D4S net files? If so is they an idea of the release date?  I don't mind upgrading to 5 but unfortunately it doesn't work with my OS for Mac and I shouldn't have to upgrade both and don't want to...Well BAD BAD me [More]
I have a subreport which includes this line in the selection formula: {Production.Date} = {?Pm-?DateRange} {?Pm-?DateRange} appears in the Subreport Links window, so it seems like it should work. The DateRange parameter is set by the user in the Main [More]
I need to perform batch lookups of employees in an Active Directory instance - thousands of employees at a time - from within an ALBPM process based on a group filter. (I.e., get all employees in group X.) This works fine for small groups, but any qu [More]