Ask a Question

how can i log all the log.info detail to a single file

nngrjg
Occasional Visitor

how can i log all the log.info detail to a single file

consider i have around 10 log.info in an script and i need to log all the 10 in a single file.could you please proved your suggestion please

1 REPLY 1
richie
Community Hero

Hey @nngrjg 

 

I've put something VERY basic together where it'll write 10 values to a flat file in a single column - you didn't say anything about infile presentation or anything like that - im sure the real coders would do something more efficient/better - but without knowing more details -  this will do the job of what you asked.

 

//below script will write 10 values in a single column in the file in a newly created file 

java.io.File

File file = new File("C://Users/Rich/Downloads/groovytest.txt")
file.write("valuefrom1stloggedvariable\n")
file.append("valuefrom2ndloggedvariable\n")
file.append("valuefrom3rdloggedvariable\n")
file.append("valuefrom4thloggedvariable\n")
file.append("valuefrom5thloggedvariable\n")
file.append("valuefrom6thloggedvariable\n")
file.append("valuefrom7thloggedvariable\n")
file.append("valuefrom8thloggedvariable\n")
file.append("valuefrom9thloggedvariable\n")
file.append("valuefrom10thloggedvariable\n")
//log.info(file.text)

 

Cheers,

 

Rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
cancel
Showing results for 
Search instead for 
Did you mean: