Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Beanshell Log File

I want to trace execution in a beanshell script, writing text and variables to a text file.  

 - How do I create a text file, in beanshell?  
 - How do I append text to a text file, in a beanshell script?
0
LarryAndro
Asked:
LarryAndro
  • 2
1 Solution
 
CEHJCommented:
Just as you would in a Java app

PrintWriter out = new PrintWriter(new FIleWriter("x.txt"));
out.println("hi");
out.close();
0
 
LarryAndroAuthor Commented:
I'm making things too hard!  Thanks...

(If anyone reads, and copies and pastes the code above, change FIleWriter... to FileWriter...)
0
 
CEHJCommented:
:-)

Using a logging API such as log4j would be better, but i'm not fully sure if it can be used in exactly the same way in beanshell
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now