Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-30-2008, 03:30 PM
Member
 
Join Date: May 2008
Posts: 3
Virkant Pawar is on a distinguished road
Log4j - setting up name of log file
Hi,
I want to name the log file as lod-30-May-04:59.log ( where date and time should change as per the log )
I searched it but i couldn't find can anybody help me
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-02-2008, 07:19 PM
Member
 
Join Date: Mar 2008
Posts: 6
chaster is on a distinguished road
Hello,
The problem is, that a filename cannot contain several characters (including ':').
I don't really understand what is your issue... Anyway, here is a piece of code, which kinda does the 'trick'
Code:
import java.util.*; import java.io.*; public class T { private static void aMethod(String fName) { Date aDate = new Date(); try{ BufferedWriter bw = new BufferedWriter(new FileWriter(fName)); bw.close(); } catch (Exception anEx){} // handle filenotfound exception & friends } public static void main(String args[]){ String fileName; Date aDate = new Date(); fileName = aDate.getDate()+"-" +aDate.getMonth()+"-" +aDate.getHours()+"." +aDate.getMinutes()+".log"; aMethod(fileName); } }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-03-2008, 08:23 AM
Member
 
Join Date: May 2008
Posts: 3
Virkant Pawar is on a distinguished road
Hi,
The code you have given should create file with name i wanted but my questation was how to write a log in that file at run-time.
any way i got the solution it can be done using org.apache.log4j.DailyRollingFileAppender
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-03-2008, 09:39 AM
Member
 
Join Date: Jun 2008
Posts: 1
Balamurugan is on a distinguished road
How to add mozilla firefox plugin manager?. can u give me any sample code?
hai

my problem is, my team leader said, to add plugin manager with mozilla firefox.i don't known this concept. anybody help me with sample code.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regarding Log4j sidiq New To Java 0 04-07-2008 09:35 PM
Log4j chakri New To Java 1 02-09-2008 12:15 AM
Servlet sending the file (setting header) Java Tip Java Tips 0 01-27-2008 10:14 PM
log4j swapna_d New To Java 5 01-21-2008 10:49 AM
log4j property file in my application Peter Advanced Java 3 06-14-2007 05:12 AM


All times are GMT +3. The time now is 01:13 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org