Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

log4j:ERROR setFile(null,true) call failed.

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am getting the following error
"log4j:ERROR setFile(null,true) call failed." When i try to run the application.

The below code is the sample class file which is used for put properties into the the Properties file.



In the action class, I am calling the above class to write the logger


When I try to run the application, it is giving me the following error when trying to write it to the log file

log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: "Mail.log" (The filename, directory name, or volume label syntax is incorrect)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(Unknown Source)
at java.io.FileOutputStream.<init>(Unknown Source)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:289)
at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:165)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:163)
at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:256)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:132)
at org.apache.log4j.config.PropertySetter.setProperties(PropertySetter.java:96)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:654)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:612)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:509)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:415)
at org.apache.log4j.PropertyConfigurator.configure(PropertyConfigurator.java:349)
at com.test.util.LogHooks.initLogger(LogHooks.java:141)
at com.test.util.LogHooks.writeOutputLog(LogHooks.java:155)
at com.test.action.MailAction.executeProcess(MailAction.java:103)
at com.tk.startup.EmailStartUp.main(EmailStartUp.java:45)

Anybody could you please tell me as to how to avoid this error file when trying to run the applicaiton

thanks in advance
Smriti
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its a late replay but it may help someone..

I came across the same issue when using the log4j.

I use a property file file in src/main/resources/log4j.properties something like..



#
#------------------------------------------------------------------------------
#log4j.rootLogger=DEBUG, S, R
log4j.rootCategory=S, R

#log4j.logger.com.dappit.Dapper.parser=ERROR
#log4j.logger.org.w3c.tidy=FATAL

#------------------------------------------------------------------------------
#
# The following properties configure the console (stdout) appender.
# See http://logging.apache.org/log4j/docs/api/index.html for details.
#
#------------------------------------------------------------------------------
log4j.appender.S = org.apache.log4j.ConsoleAppender
log4j.appender.S.layout = org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern =%d{yyyy-MM-dd HH:mm:ss} %t/%c{1} [%p] %m%n

#------------------------------------------------------------------------------
#
# The following properties configure the Daily Rolling File appender.
# See http://logging.apache.org/log4j/docs/api/index.html for details.
#
#------------------------------------------------------------------------------
log4j.appender.R = org.apache.log4j.RollingFileAppender
log4j.appender.R.File = "DataSourceFactory.log"
log4j.appender.R.Append = true
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=1000
#log4j.appender.R.DatePattern = '.'yyy-MM-dd
log4j.appender.R.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern =%d{yyyy-MM-dd HH:mm:ss} %t/%c{1} [%p] %m%n


#---------------------------------------------------------------------------------------

removing the double quotes from the log4j.appender.R.File = "DataSourceFactory.log" entry solved my problem easily.
 
Squanch that. And squanch this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic