You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by AbelMacAdam <ab...@gmail.com> on 2008/01/11 11:21:38 UTC

Using Log4j in an Applet?

Hi,

For the Applet I develop I want to log events. I found out I should use
org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this
SimpleSocketServer can run independently from any Server software?

What I don't know is how I inform my Applet where to send its logging
information to (or put otherwise, I get the following lines in my Eclipse
console:
log4j:WARN No appenders could be found for logger
(nl.domain.myApp.MyApplet).
log4j:WARN Please initialize the log4j system properly.

I made a log4j.properties file, and put it in my WEB-INF/classes directory.
The contents of this file is:
log4j.debug=TRUE
log4j.rootLogger=WARN, R

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=D:/workspace/myApp/myApp.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n

I use the following command to start the SimpleSocketServer:
java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
org.apache.log4j.net.SimpleSocketServer 13013
d:\workspace\myApp\WEB-INF\classes\log4j.properties

Stating the obvious, a myApp.log is created in the correct place. 



There seems to fail something in my log4j.properties file. Something like a
server (localhost:13013)? What do I add to this file?

TIA
Abel

-- 
View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using Log4j in an Applet?

Posted by Maarten Bosteels <mb...@gmail.com>.
I think the property should just be a hostname, so I would drop the "http://"

log4j.appender.R.server=www.myserver.com:13013

Maarten

On Jan 11, 2008 4:26 PM, James A. N. Stauffer <st...@gmail.com> wrote:
> You would use the address that the browser sees so something like
> http://www.{myserver}.com:13013
>
>
> On Jan 11, 2008 9:23 AM, AbelMacAdam <ab...@gmail.com> wrote:
> >
> > Thanks for your reply.
> >
> > That is what I would like to accomplish, sending logging information to the
> > server. Would there be something like
> > og4j.appender.R.server=http://localhost:13013
> > or
> > og4j.appender.R.server=http://www.{myserver}.com:13013
> > I could add to my log4j.properties file?
> >
> > Abel.
> >
> >
> >
> > James A. N. Stauffer wrote:
> > >
> > > Unless signed and given permission, an applet can only communicate to
> > > the server that served the applet class/jar file(s).  Therefore the
> > > SimpleSocketServer will need to run on the webserver that servered the
> > > applet.  You need to configure your applet to send the logs over a
> > > SocketAppender back to the server.
> > >
> > > On Jan 11, 2008 4:21 AM, AbelMacAdam <ab...@gmail.com> wrote:
> > >>
> > >> Hi,
> > >>
> > >> For the Applet I develop I want to log events. I found out I should use
> > >> org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this
> > >> SimpleSocketServer can run independently from any Server software?
> > >>
> > >> What I don't know is how I inform my Applet where to send its logging
> > >> information to (or put otherwise, I get the following lines in my Eclipse
> > >> console:
> > >> log4j:WARN No appenders could be found for logger
> > >> (nl.domain.myApp.MyApplet).
> > >> log4j:WARN Please initialize the log4j system properly.
> > >>
> > >> I made a log4j.properties file, and put it in my WEB-INF/classes
> > >> directory.
> > >> The contents of this file is:
> > >> log4j.debug=TRUE
> > >> log4j.rootLogger=WARN, R
> > >>
> > >> log4j.appender.R=org.apache.log4j.RollingFileAppender
> > >> log4j.appender.R.File=D:/workspace/myApp/myApp.log
> > >> log4j.appender.R.MaxFileSize=100KB
> > >> log4j.appender.R.MaxBackupIndex=5
> > >> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> > >> log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n
> > >>
> > >> I use the following command to start the SimpleSocketServer:
> > >> java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
> > >> org.apache.log4j.net.SimpleSocketServer 13013
> > >> d:\workspace\myApp\WEB-INF\classes\log4j.properties
> > >>
> > >> Stating the obvious, a myApp.log is created in the correct place.
> > >>
> > >>
> > >>
> > >> There seems to fail something in my log4j.properties file. Something like
> > >> a
> > >> server (localhost:13013)? What do I add to this file?
> > >>
> > >> TIA
> > >> Abel
> > >>
> > >> --
> > >> View this message in context:
> > >> http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html
> > >> Sent from the Log4j - Users mailing list archive at Nabble.com.
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> > > Are you good? Take the test at http://www.livingwaters.com/good/
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> > >
> >
> > --
> > View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14758364.html
> >
> > Sent from the Log4j - Users mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
>
> --
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using Log4j in an Applet?

Posted by "James A. N. Stauffer" <st...@gmail.com>.
You would use the address that the browser sees so something like
http://www.{myserver}.com:13013

On Jan 11, 2008 9:23 AM, AbelMacAdam <ab...@gmail.com> wrote:
>
> Thanks for your reply.
>
> That is what I would like to accomplish, sending logging information to the
> server. Would there be something like
> og4j.appender.R.server=http://localhost:13013
> or
> og4j.appender.R.server=http://www.{myserver}.com:13013
> I could add to my log4j.properties file?
>
> Abel.
>
>
>
> James A. N. Stauffer wrote:
> >
> > Unless signed and given permission, an applet can only communicate to
> > the server that served the applet class/jar file(s).  Therefore the
> > SimpleSocketServer will need to run on the webserver that servered the
> > applet.  You need to configure your applet to send the logs over a
> > SocketAppender back to the server.
> >
> > On Jan 11, 2008 4:21 AM, AbelMacAdam <ab...@gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> For the Applet I develop I want to log events. I found out I should use
> >> org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this
> >> SimpleSocketServer can run independently from any Server software?
> >>
> >> What I don't know is how I inform my Applet where to send its logging
> >> information to (or put otherwise, I get the following lines in my Eclipse
> >> console:
> >> log4j:WARN No appenders could be found for logger
> >> (nl.domain.myApp.MyApplet).
> >> log4j:WARN Please initialize the log4j system properly.
> >>
> >> I made a log4j.properties file, and put it in my WEB-INF/classes
> >> directory.
> >> The contents of this file is:
> >> log4j.debug=TRUE
> >> log4j.rootLogger=WARN, R
> >>
> >> log4j.appender.R=org.apache.log4j.RollingFileAppender
> >> log4j.appender.R.File=D:/workspace/myApp/myApp.log
> >> log4j.appender.R.MaxFileSize=100KB
> >> log4j.appender.R.MaxBackupIndex=5
> >> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> >> log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n
> >>
> >> I use the following command to start the SimpleSocketServer:
> >> java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
> >> org.apache.log4j.net.SimpleSocketServer 13013
> >> d:\workspace\myApp\WEB-INF\classes\log4j.properties
> >>
> >> Stating the obvious, a myApp.log is created in the correct place.
> >>
> >>
> >>
> >> There seems to fail something in my log4j.properties file. Something like
> >> a
> >> server (localhost:13013)? What do I add to this file?
> >>
> >> TIA
> >> Abel
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html
> >> Sent from the Log4j - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >>
> >
> >
> >
> > --
> > James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> > Are you good? Take the test at http://www.livingwaters.com/good/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14758364.html
>
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>



-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using Log4j in an Applet?

Posted by AbelMacAdam <ab...@gmail.com>.
Thanks for your reply. 

That is what I would like to accomplish, sending logging information to the
server. Would there be something like
og4j.appender.R.server=http://localhost:13013
or
og4j.appender.R.server=http://www.{myserver}.com:13013
I could add to my log4j.properties file? 

Abel.


James A. N. Stauffer wrote:
> 
> Unless signed and given permission, an applet can only communicate to
> the server that served the applet class/jar file(s).  Therefore the
> SimpleSocketServer will need to run on the webserver that servered the
> applet.  You need to configure your applet to send the logs over a
> SocketAppender back to the server.
> 
> On Jan 11, 2008 4:21 AM, AbelMacAdam <ab...@gmail.com> wrote:
>>
>> Hi,
>>
>> For the Applet I develop I want to log events. I found out I should use
>> org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this
>> SimpleSocketServer can run independently from any Server software?
>>
>> What I don't know is how I inform my Applet where to send its logging
>> information to (or put otherwise, I get the following lines in my Eclipse
>> console:
>> log4j:WARN No appenders could be found for logger
>> (nl.domain.myApp.MyApplet).
>> log4j:WARN Please initialize the log4j system properly.
>>
>> I made a log4j.properties file, and put it in my WEB-INF/classes
>> directory.
>> The contents of this file is:
>> log4j.debug=TRUE
>> log4j.rootLogger=WARN, R
>>
>> log4j.appender.R=org.apache.log4j.RollingFileAppender
>> log4j.appender.R.File=D:/workspace/myApp/myApp.log
>> log4j.appender.R.MaxFileSize=100KB
>> log4j.appender.R.MaxBackupIndex=5
>> log4j.appender.R.layout=org.apache.log4j.PatternLayout
>> log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n
>>
>> I use the following command to start the SimpleSocketServer:
>> java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
>> org.apache.log4j.net.SimpleSocketServer 13013
>> d:\workspace\myApp\WEB-INF\classes\log4j.properties
>>
>> Stating the obvious, a myApp.log is created in the correct place.
>>
>>
>>
>> There seems to fail something in my log4j.properties file. Something like
>> a
>> server (localhost:13013)? What do I add to this file?
>>
>> TIA
>> Abel
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html
>> Sent from the Log4j - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
> 
> 
> 
> -- 
> James A. N. Stauffer        http://www.geocities.com/stauffer_james/
> Are you good? Take the test at http://www.livingwaters.com/good/
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14758364.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Using Log4j in an Applet?

Posted by "James A. N. Stauffer" <st...@gmail.com>.
Unless signed and given permission, an applet can only communicate to
the server that served the applet class/jar file(s).  Therefore the
SimpleSocketServer will need to run on the webserver that servered the
applet.  You need to configure your applet to send the logs over a
SocketAppender back to the server.

On Jan 11, 2008 4:21 AM, AbelMacAdam <ab...@gmail.com> wrote:
>
> Hi,
>
> For the Applet I develop I want to log events. I found out I should use
> org.apache.log4j.net.SimpleSocketServer. Am I correct in assuming this
> SimpleSocketServer can run independently from any Server software?
>
> What I don't know is how I inform my Applet where to send its logging
> information to (or put otherwise, I get the following lines in my Eclipse
> console:
> log4j:WARN No appenders could be found for logger
> (nl.domain.myApp.MyApplet).
> log4j:WARN Please initialize the log4j system properly.
>
> I made a log4j.properties file, and put it in my WEB-INF/classes directory.
> The contents of this file is:
> log4j.debug=TRUE
> log4j.rootLogger=WARN, R
>
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=D:/workspace/myApp/myApp.log
> log4j.appender.R.MaxFileSize=100KB
> log4j.appender.R.MaxBackupIndex=5
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %c - %m%n
>
> I use the following command to start the SimpleSocketServer:
> java -cp D:\lib\apache-log4j-1.2.15\log4j-1.2.15.jar
> org.apache.log4j.net.SimpleSocketServer 13013
> d:\workspace\myApp\WEB-INF\classes\log4j.properties
>
> Stating the obvious, a myApp.log is created in the correct place.
>
>
>
> There seems to fail something in my log4j.properties file. Something like a
> server (localhost:13013)? What do I add to this file?
>
> TIA
> Abel
>
> --
> View this message in context: http://www.nabble.com/Using-Log4j-in-an-Applet--tp14753143p14753143.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>



-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org