[izpack-users] Using ProcessPanel and Log4J
Mandeep Saini
Mandeep.Saini at dante.org.uk
Tue Apr 24 15:52:19 CEST 2007
one more thing, your LicenseInstall class should also be included as a
jar file along with the other jar files in install.xml. for eg.
if name of the jar file which contains LicenseInstall.class is
'process.jar' then u will add following in the install.xml:
<jar src="process.jar"/>
Regards
Mandeep
Marius Hugo wrote:
> Thanks, I tried all of that now, but I still get an exception and I
> cannot get the ProcessPanel logging to work...
> My code that im passing looks like this
>
> public class LicenseInstall {
> public void run(AbstractUIProcessHandler handler, String[]
> args){
> String install_path = args[0];
> Util.configureLogging();
> Util.setLogLevel(Util.VERBOSE);
> Util.log(Util.VERBOSE,"WORKING",classname,null);
>
> try{
> LicenseInstall l = new LicenseInstall(args);
> } catch (Exception x){
> Util.log(Util.ERROR,"Uh-oh! ", classname,x);
> }
> }
>
> ...
> ..
> ..
> ..
> }
>
> I expected to have a log file created containing the text "WORKING" on
> the C drive as is configured in my log4j, that didn't work inside the
> ProcessPanel (if I just run it in my environment it works)
> I have tried to just make a BufferedWriter and create a text file just
> to see if my class at least
> runs, but that also does nothing...so I don't think the log4j is the
> problem.
>
> I get the following window that pops up when I run the process panel:
> Title -> Post Processing Error
> -> Exception when running class:
> com.traderoot.tools.artifact.installer.LicenseInstall,
> com.traderoot.tools.artifact.installer.LicenseInstall.
>
> Could anyone point out anything that I'm missing? I'm gonna attach my
> install.xml file, etc...
>
> Thanks,
> Marius
>
>
> -----Original Message-----
> From: izpack-users-bounces at lists.berlios.de
> [mailto:izpack-users-bounces at lists.berlios.de] On Behalf Of Mandeep
> Saini
> Sent: 20 April 2007 11:20
> To: izpack-users at lists.berlios.de
> Subject: Re: [izpack-users] Using ProcessPanel and Log4J
>
> Hi Marius,
>
> see the related comments below:
> Marius Hugo wrote:
>> Hi, I'm new to IzPack and I'm having a bit of trouble with the
> following:
>>
>> I have to merge files based on versioning and a license that I must
>> parse. I have written my own code to handle this and included it in a
>
>> ProcessPanel. I loaded the jars necessary using the <jar> tag (these
>> tags are in my install.xml).
>
> Make sure you also include the jars on which your class has dependency,
> unless its already in izpack. For example, if my classes have dependency
> on 'commons-codec-1.3.jar' and my processing classes are in another jar
> file (say processingClasses.jar) then in my install.xml I will write:
>
> <jar src="target/processPanelJar/processingClasses.jar" /> <jar
> src="target/jars/commons-codec-1.3.jar" />
>
>
>> When I get to running the panel, it simply tells me that there has
>> been an exception using my class and there is no actual indication
>> that the correct action was taken or that my class was even run (I
>> also have no clue what the exception is, it doesn't specify)
>>
>> My class uses log4j and that has to read a file for its config.
>> Normally I would just say the following:
>> java -Dlog4j.configuration=log4j.properties com.bla bla bla.MyClass
>
> If your class file needs some config file like 'log4j.properties' then
> the jar file which contains your class should also contain the
> properties file. make the code to find it from there.
>>
>> How would I get this right in the process panel? Cause I need to see
>> the logs so that I can know what's going on.
>>
>> Also, I attempted to enable the ProcessPanel logging, but the file
>> never gets created in $INSTALL_PATH.
>
> I have also tried to enable ProcessPanel logging but I could not do so.
> As far as I remember this feature is not completely implemented yet but
> I cant remember the actual cause.
>> My ProcessPanel config looks a little something like this:
>>
>> <processing>
>> <job name="InstallArtifacts">
>> <logfiledir>$INSTALL_PATH</logfiledir>
>> <executeclass
> name="com.traderoot.tools.artifact.installer.LicenseInstall">
>> <args>
>> <arg value="$trtLicense"/>
>> <arg value="$INSTALL_PATH/TradeRoot/Installations/"/>
>> <arg value="$INSTALL_PATH/TradeRoot/Repositories"/>
>> <arg value="Stack"/>
>> </args>
>> </executeclass>
>> </job>
>> </processing>
>>
>> $trtLicense -> location of license that i captured in a UserInput
> panel....
>> I understand that all these values are passed in the specified order
>> to the main method of the class that I specified.
>
> When you write any class for process panel, you don't need to write main
> method instead you write the run( AbstractUIProcessHandler handler,
> String[] args) method. For example:
>
> import com.izforge.izpack.util.AbstractUIProcessHandler;
>
> public class MyClass {
>
> public void run( AbstractUIProcessHandler handler, String[] args){
> String install_path = args[0];
> myMethod(install_path);
> }
>
> public void myMethod(){
> }
> }
>
> Hope this works for you.
>
> Regards
> Mandeep
>
>>
>> thanks guys
>>
>>
>>
>>
>>
>> MARIUS HUGO
>>
>>
>> SOFTWARE ENGINEER
>>
>>
>> c
>> t
>> f
>> +27 72 237 4083
>> +27 21 551 5444
>> +27 21 551 5449
>>
>> *TRADEROOT **TECHNOLOGIES (Pty)Ltd. Reg. No. 2000/005984/07.
>> www.traderoot.com Directors* E von Engelhardt, J Ludik, B Dungan, W
> Reece.
>>
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> _______________________________________________
>> izpack-users mailing list
>> izpack-users at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/izpack-users
>
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
>
> <!--
>
> Some handy tips....
>
> VARIABLES
>
> <variables>
> <variable name="app-version" value="1.4"/>
> <variable name="released-on" value="08/03/2002"/>
> </variables>
>
> use variable as follows -> $name
>
>
>
> -->
>
>
>
> <installation version="1.0">
>
>
>
>
> <!-- gui preferences -->
>
> <guiprefs height="700" resizable="yes" width="900">
> <laf name="metouia">
> <os family="unix" />
> <param name="decorate.frames" value="yes" />
> <param name="decorate.dialogs" value="yes" />
> </laf>
> <laf name="metouia">
> <os family="windows" />
> <param name="decorate.frames" value="yes" />
> <param name="decorate.dialogs" value="yes" />
> </laf>
> </guiprefs>
>
>
>
> <!--
> Specify the supported languages
> -->
> <locale>
> <langpack iso3="eng"/>
> </locale>
>
>
> <!--
> Specify resources that can be loaded by the panels (defined and used later in this file)
> I defined the logo, text containing info and the license agreement
> -->
>
> <resources>
> <res id="Installer.image" src="/Logo/logo.jpg"/> <!-- left hand picture for all panes, trtLogo
> ...can also specify for each panel...id=Installer.image.n, where n=0..lastpanel-1 -->
>
> <res id="InfoPanel.info" src="/Doc/ReadMe.txt"/>
> <res id="LicencePanel.licence" src="/Legal/License.txt"/>
> <res id="userInputSpec.xml" src="userInputSpec.xml"/>
> <res id="ProcessPanel.Spec.xml" src="ProcessPanel.Spec.xml"/>
> </resources>
>
>
> <jar src="lib/artifact-SNAPSHOT.jar"/>
> <jar src="lib/commons-io-1.1.jar"/>
> <jar src="lib/commons-logging-1.0.4.jar"/>
> <jar src="lib/log4j-1.2.8.jar"/>
> <jar src="lib/truezip-6.jar"/>
>
> <!--
> Indicate the panels we want to use, in order.
> -->
> <panels>
> <panel classname="HelloPanel"/>
> <panel classname="InfoPanel"/>
> <panel classname="UserInputPanel"/>
> <panel classname="LicencePanel"/>
> <panel classname="TargetPanel"/>
> <panel classname="PacksPanel"/>
> <panel classname="InstallPanel"/>
> <panel classname="ProcessPanel"/>
> <panel classname="FinishPanel"/>
> </panels>
>
>
>
> <!-- InfoPanel -> info about this installer....for the info panel... -->
>
> <info>
> <appname>TradeRoot</appname>
> <appversion>4.5.1</appversion>
> <authors>
> <author name="Marius" email="marius.hugo at traderoot.com"/>
> <author name="TRADEROOT" email="traderoot at traderoot.com"/>
> </authors>
> <url>http://www.traderoot.com/</url>
> <javaversion>1.4</javaversion>
> </info>
>
>
>
>
> <!--
> The packs section.
> We specify our packs here.
> -->
>
>
>
> <packs>
> <pack name="TradeRoot Core" required="yes">
> <description>The core files required for a TradeRoot Installation. Please note that you are required to select at least one Installation</description>
> <required>yes</required>
> <preselected>yes</preselected>
> <file src="TradeRoot Skeleton/Export" targetdir="$INSTALL_PATH">
> <exclude>**</exclude>
> </file>
> <file src="TradeRoot Skeleton/Import" targetdir="$INSTALL_PATH">
> <exclude>**</exclude>
> </file>
>
> <file src="TradeRoot Skeleton/Installations" targetdir="$INSTALL_PATH">
> <exclude>**</exclude>
> </file>
> <file src="TradeRoot Skeleton/Java" targetdir="$INSTALL_PATH">
> <exclude>**</exclude>
> </file>
> <file src="TradeRoot Skeleton/UserApplications" targetdir="$INSTALL_PATH">
> <exclude>**</exclude>
> </file>
>
> <file src="TradeRoot Skeleton/Repositories" targetdir="$INSTALL_PATH"/>
> <file src="TradeRoot Skeleton/Install" targetdir="$INSTALL_PATH"/>
>
>
> </pack>
> </packs>
>
> </installation>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> <processing>
> <job name="InstallArtifacts">
> <logfiledir>$INSTALL_PATH</logfiledir>
> <jar src="lib/artifact-SNAPSHOT.jar"/>
> <jar src="lib/commons-io-1.1.jar"/>
> <jar src="lib/commons-logging-1.0.4.jar"/>
> <jar src="lib/log4j-1.2.8.jar"/>
> <jar src="lib/truezip-6.jar"/>
> <executeclass name="com.traderoot.tools.artifact.installer.LicenseInstall">
> <args>
> <arg value="$trtLicense"/>
> <arg value="$INSTALL_PATH/TradeRoot/Installations/"/>
> <arg value="$INSTALL_PATH/TradeRoot/Repositories"/>
> <arg value="Stack"/>
> </args>
> </executeclass>
> </job>
> </processing>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> izpack-users mailing list
> izpack-users at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-users
More information about the izpack-users
mailing list