I am trying to write a output for my log in file on the desktop but for somereason, it is not doing that.It says the file cant be instantiated.
I have the code and console output below. Any help would be much appreciated. thanks in advance.

direct log messages to stdout

Please, copy this file to YourProject\src folder

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p - %m%n

log4j.appender.default.file=org.apache.log4j.FileAppender
log4j.appender.default.file.append=true
log4j.appender.default.file.FILE=C:\Users\Gagan\Desktop\logfile\log\mylogfile.log
log4j.appender.default.file.layout=org.apache.log4j.PatternLayout
log4j.appender.default.file.layout.ConversionPattern=%-5p %c: %m%n
log4j.appender.default.file.threshold=INFO,

log4j.rootLogger=warn, stdout, filelog4j:ERROR Could not find value for key log4j.appender.File
log4j:ERROR Could not instantiate appender named "file".
2014/06/30 06:40:43 TRACE - Trace messages
2014/06/30 06:40:43 DEBUG - debug message
2014/06/30 06:40:43 INFO - info message
2014/06/30 06:40:43 WARN - warning
2014/06/30 06:40:43 ERROR - error message
2014/06/30 06:40:43 FATAL - fatal message

Try replacing the backslashes with forward slashes or double backslashes.

Also, you need to specify the appender names in the rootlogger. Something like:

log4j.rootLogger=DEBUG, default.out, default.file

Take a look at this post.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.