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 am having the problem shown below: # An unexpected error has been detected by HotSpot Virtual Machine: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0b2da214, pid=876, tid=2584 # Java VM: Java HotSpot(TM) Client VM (1.5.0_10-b03 mi [More]
I'm having difficulties adding and removing files from my 160 gb WD passport external hard drive. it has just recently began to act up on me. i use it primarily for my itunes library. however, recently when i try to import music music into my itunes, [More]
I want to subscribe the user group to the RSS feed for a discussion board in Sharepoint 2010 and make it an opt out feature not an opt in feature. Is this something i can do? And how. Hi, If a user wants to subscribe to a RSS feed of SharePoint list/ [More]
what if i have a tabular form and i wish to display a different background color when one of the field is displaying 'Y' instead of 'N'. How can i do so?[email protected] wrote: Hi, I have used your method and in fact, i placed it in the block's WHEN [More]
GPS signal weak or gone after iPhone upgrade. I am trying to use the Nike+ app for tracking runs and signal never strong enough to track location. Any fixes?You need a better mic like the one from Blue: http://www.bluemic.com/mikeyforipod/#/desc/Read [More]
Does any know how to install the Planning Adapter for ODI? I cannot find any documentation that actually explains how to do the install. The only documentation I can find on the Hyperion site is a README file. The ODI installation and user guide do n [More]
I am setting up a sign up form for a variety of choices.  There are only a certain number of each choice needed. How can I make a form either hide or limit a choice once the necessary qty has been reached by other responders? ThanksHi; This isn't som [More]
Hey. When I'm trying to start a simple TopicSubcriber client, i'm getting error: Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/inte rnal/util/JDKBridge at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHol [More]
I bought a new TP Link Router & dual aerial wireless USB adapters to solve my line speed issues as the old BT Home hub 1.5 cannot handle the new exchange. http://www.shop.bt.com/products/tp-link-300mbps-wireless-n-adsl-router-77S0.html Now some websi [More]
Hi, My  portal team is currently developing some reports using the SAP Visual Composer tool. How do we make a BW cube or ODS available for VC to see? They can currently see only a few of the cubes, but we don't know how those are visible to VC and no [More]