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 darshan <da...@gmail.com> on 2005/11/24 07:48:48 UTC

configuring repositorySelector in Jboss run.bat

Hi,
After many useful Suggestions....
i tried my best to configure the JNDIconext Selector from the options given as:
 -Dlog4j.repositorySelector=org.apache.log4j.selector.ContextJNDISelector 
inside the run.bat
So anyone plz give me a sample run.bat wherein we have configured the 
repositorySelector in the run.bat


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


Re: configuring repositorySelector in Jboss run.bat

Posted by Jacob Kjome <ho...@visi.com>.
Ok, looks like they allow for importing an externally set %JAVA_OPTS% 
environment variable and place it in-line with the "java" command.  So, set 
the following Windows NT/2K/XP environment variable...

JAVA_OPTS=-Dlog4j.repositorySelector=JNDI

You can do this either on the command line of the command window that you 
will later be running the JBoss bootstrap script or you can set it 
permanently by right clicking "My Computer".  On XP, go to the "Advanced" 
tab and then click on the "Environment Variables" button.  Either set a 
system or user environment variable.  System variables are available to any 
user on the machine and user variables only apply to the current 
user.  Click "Ok" to all the dialogs to save the information.  Open a new 
command prompt window and double check that you have access to the newly 
set variable by typing...

echo %JAVA_OPTS%.  If the value isn't what you expect it to be, you will 
probably have to reboot your machine for the new variable to take.  Windows 
is very annoying about this.

After you verify that JAVA_OPTS has the right value in the command prompt 
window, you can go ahead and run your JBoss bootstrap script and it will 
pick up the setting.  You should be all set to go at this pont.

Jake

At 08:07 AM 11/25/2005 +0000, you wrote:
 >darshan <darshandarshan <at> gmail.com> writes:
 >
 >Hi,
 >my jboss 4.0.2 run.bat is as follows, plz tell me where shud i place the 
-D...
 >Argument in this below run.bat
 >============================================================================
 >====
 >============================================================================
 >====
 >@echo off
 >rem -------------------------------------------------------------------------
 >rem JBoss Bootstrap Script for Win32
 >rem -------------------------------------------------------------------------
 >-Dlog4j.repositorySelector=JNDI
 >rem $Id: run.bat,v 1.13.4.1 2004/12/15 16:52:20 starksm Exp $
 >
 >@if not "%ECHO%" == ""  echo %ECHO%
 >@if "%OS%" == "Windows_NT"  setlocal
 >
 >set DIRNAME=.\
 >if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
 >set PROGNAME=run.bat
 >if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%
 >
 >rem Read all command line arguments
 >
 >REM
 >REM The %ARGS% env variable commented out in favor of using %* to include
 >REM all args in java command line. See bug #840239. [jpl]
 >REM
 >REM set ARGS=
 >REM :loop
 >REM if [%1] == [] goto endloop
 >REM         set ARGS=%ARGS% %1
 >REM         shift
 >REM         goto loop
 >REM :endloop
 >
 >rem Find run.jar, or we can't continue
 >
 >set RUNJAR=%DIRNAME%\run.jar
 >if exist "%RUNJAR%" goto FOUND_RUN_JAR
 >echo Could not locate %RUNJAR%. Please check that you are in the
 >echo bin directory when running this script.
 >goto END
 >
 >:FOUND_RUN_JAR
 >
 >if not "%JAVA_HOME%" == "" goto ADD_TOOLS
 >
 >set JAVA=java
 >
 >echo JAVA_HOME is not set.  Unexpected results may occur.
 >echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
 >goto SKIP_TOOLS
 >
 >:ADD_TOOLS
 >
 >set JAVA=%JAVA_HOME%\bin\java
 >
 >if exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
 >echo Could not locate %JAVA_HOME%\lib\tools.jar. Unexpected results may 
occur.
 >echo Make sure that JAVA_HOME points to a JDK and not a JRE.
 >
 >:SKIP_TOOLS
 >
 >rem Include the JDK javac compiler for JSP pages. The default is for a 
Sun JDK
 >rem compatible distribution to which JAVA_HOME points
 >
 >set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar
 >
 >rem If JBOSS_CLASSPATH is empty, don't include it, as this will
 >rem result in including the local directory, which makes error tracking
 >rem harder.
 >if "%JBOSS_CLASSPATH%" == "" (
 >       set JBOSS_CLASSPATH=%JAVAC_JAR%;%RUNJAR%
 >) ELSE (
 >       set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%
 >)
 >
 >rem Setup JBoss specific properties
 >set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
 >set JBOSS_HOME=%DIRNAME%\..
 >
 >rem Sun JVM memory allocation pool parameters. Modify as appropriate.
 >set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m
 >
 >rem JPDA options. Uncomment and modify as appropriate to enable remote
 >debugging.
 >rem set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -
 >Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%
 >
 >rem Setup the java endorsed dirs
 >set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed
 >
 >echo
 >===============================================================================
 >echo .
 >echo   JBoss Bootstrap Environment
 >echo .
 >echo   JBOSS_HOME: %JBOSS_HOME%
 >echo .
 >echo   JAVA: %JAVA%
 >echo .
 >echo   JAVA_OPTS: %JAVA_OPTS%
 >echo .
 >echo   CLASSPATH: %JBOSS_CLASSPATH%
 >echo .
 >echo
 >===============================================================================
 >echo .
 >
 >:RESTART
 >"%JAVA%" %JAVA_OPTS% "-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%" 
-classpath "%
 >JBOSS_CLASSPATH%" org.jboss.Main %*
 >IF ERRORLEVEL 10 GOTO RESTART
 >
 >:END
 >if "%NOPAUSE%" == "" pause
 >
 >:END_NO_PAUSE
 >
 >
 >
 >
 >---------------------------------------------------------------------
 >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: configuring repositorySelector in Jboss run.bat

Posted by darshan <da...@gmail.com>.
darshan <darshandarshan <at> gmail.com> writes:

Hi,
my jboss 4.0.2 run.bat is as follows, plz tell me where shud i place the -D...
Argument in this below run.bat
================================================================================
================================================================================
@echo off
rem -------------------------------------------------------------------------
rem JBoss Bootstrap Script for Win32
rem -------------------------------------------------------------------------
-Dlog4j.repositorySelector=JNDI 
rem $Id: run.bat,v 1.13.4.1 2004/12/15 16:52:20 starksm Exp $

@if not "%ECHO%" == ""  echo %ECHO%
@if "%OS%" == "Windows_NT"  setlocal

set DIRNAME=.\
if "%OS%" == "Windows_NT" set DIRNAME=%~dp0%
set PROGNAME=run.bat
if "%OS%" == "Windows_NT" set PROGNAME=%~nx0%

rem Read all command line arguments

REM
REM The %ARGS% env variable commented out in favor of using %* to include
REM all args in java command line. See bug #840239. [jpl]
REM
REM set ARGS=
REM :loop
REM if [%1] == [] goto endloop
REM         set ARGS=%ARGS% %1
REM         shift
REM         goto loop
REM :endloop

rem Find run.jar, or we can't continue

set RUNJAR=%DIRNAME%\run.jar
if exist "%RUNJAR%" goto FOUND_RUN_JAR
echo Could not locate %RUNJAR%. Please check that you are in the
echo bin directory when running this script.
goto END

:FOUND_RUN_JAR

if not "%JAVA_HOME%" == "" goto ADD_TOOLS

set JAVA=java

echo JAVA_HOME is not set.  Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SKIP_TOOLS

:ADD_TOOLS

set JAVA=%JAVA_HOME%\bin\java

if exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
echo Could not locate %JAVA_HOME%\lib\tools.jar. Unexpected results may occur.
echo Make sure that JAVA_HOME points to a JDK and not a JRE.

:SKIP_TOOLS

rem Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
rem compatible distribution to which JAVA_HOME points

set JAVAC_JAR=%JAVA_HOME%\lib\tools.jar

rem If JBOSS_CLASSPATH is empty, don't include it, as this will 
rem result in including the local directory, which makes error tracking
rem harder.
if "%JBOSS_CLASSPATH%" == "" (
	set JBOSS_CLASSPATH=%JAVAC_JAR%;%RUNJAR%
) ELSE (
	set JBOSS_CLASSPATH=%JBOSS_CLASSPATH%;%JAVAC_JAR%;%RUNJAR%
)

rem Setup JBoss specific properties
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
set JBOSS_HOME=%DIRNAME%\..

rem Sun JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

rem JPDA options. Uncomment and modify as appropriate to enable remote 
debugging.
rem set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE -
Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y %JAVA_OPTS%

rem Setup the java endorsed dirs
set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed

echo 
===============================================================================
echo .
echo   JBoss Bootstrap Environment
echo .
echo   JBOSS_HOME: %JBOSS_HOME%
echo .
echo   JAVA: %JAVA%
echo .
echo   JAVA_OPTS: %JAVA_OPTS%
echo .
echo   CLASSPATH: %JBOSS_CLASSPATH%
echo .
echo 
===============================================================================
echo .

:RESTART
"%JAVA%" %JAVA_OPTS% "-Djava.endorsed.dirs=%JBOSS_ENDORSED_DIRS%" -classpath "%
JBOSS_CLASSPATH%" org.jboss.Main %*
IF ERRORLEVEL 10 GOTO RESTART

:END
if "%NOPAUSE%" == "" pause

:END_NO_PAUSE




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


Re: configuring repositorySelector in Jboss run.bat

Posted by Jacob Kjome <ho...@visi.com>.
First, you can simply use...

-Dlog4j.repositorySelector=JNDI

Second, how do you start up JBoss?  I don't use JBoss ATM, but let's say 
you start it up with "run.bat".  I'm assuming here that JBoss' startup 
script adds extra parameters that you add on the command line to it to the 
"java" invocation.  If that is true, just do...

run.bat -Dlog4j.repositorySelector=JNDI

otherwise, you might have to open run.bat and wherever the "java" 
invocation is, just add "-Dlog4j.repositorySelector=JNDI" to it.  If you 
are unsure exacty how to do this, you could post the relevent portion of 
the run.bat script and we can show you where to put the -D parameter.

Oh, and make double sure that log4j-1.3alpha7.jar is in JBoss' classpath, 
not log4j-1.2.x.jar, otherwise there is no way this is going to work.

Jake


At 06:48 AM 11/24/2005 +0000, you wrote:
 >Hi,
 >After many useful Suggestions....
 >i tried my best to configure the JNDIconext Selector from the options 
given as:
 > -Dlog4j.repositorySelector=org.apache.log4j.selector.ContextJNDISelector
 >inside the run.bat
 >So anyone plz give me a sample run.bat wherein we have configured the
 >repositorySelector in the run.bat
 >
 >
 >---------------------------------------------------------------------
 >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