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
Why is the Amber update different for ATT and China? For Lumia 520, it could tap to unlock but, in china, this function is disappeared disappear. Could you give an expain as the matching hardware, otherwise I think it's a definately discriminatory to [More]
Configuration: Jdeveloper 9i Release 2 Production Version I have a customized orion-application.xml file under <project-directory>/src/META-INF directory. I would like to package this along with my application. How do I include it in my Deployment P [More]
After update to O/S 7.1.2 my iPad2 is stuck on Vertical Orientation and will not shift to horizontal as it has in the past.  How can I get the flexible orientation back??I agree with what FoxFifth has said, but I want to add a little to the discussio [More]
My moms 3GS will not search for software updates it keeps saying there was error. And my dads will go the download and installing but that is it. It won't do it. They both want the iOS 5.1No idea.  How would we know?  What happens when you try?Read o [More]
Hi Does anyone have a solution to the problem of not being able to view the content of PDFs in Large or Extra Large mode on a Windows 7 (Enterprise SP1) 64-bit system?  I've tried installing Reader 10.0.0, 10.1.4, and 11 - all result in displaying th [More]
Hi folks, I recently had my PC re-imaged.  After that when ever I try to click on any link that should result in a pop-up window nothing happens.  The system locks up for about 20-30 seconds and then comes back with no result. I already checked and t [More]
How do I set up an email account for my sons iPod so he can do face time and Game Center with friends?I would create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the Non [More]
i can`t find the ios7 update (your ios6.1.4 is up to date) why?How are you trying to update, direct on your iPad via Settings > General > Software Update, or via your computer's iTunes ? If via your computer then you will need iTunes 11.1 installed [More]
I got a document today from a customer that i could not open. I have InDesign 5.0 and i think they have 5.5. My computer says this: Could not open document. Update plugin-programs or change to newest version of InDesign" Missing plugins are: FormFiel [More]
Hi folks.  I'm a pro cartoonist who has been using Flash on and off for years as a web tool so I know my way 'round most basic stuff. The other day though, I was asked to produce a short 20 sec production for a TV commercial and I said  "Sure, why no [More]