diagnose why my Cobertura output from Ant is in debug mode - ant

I've set up an Ant script to run unit tests with Cobertura. For some reason I'm getting the log4j DEBUG output from Cobertura. I've been staring at this for hours using all the diagnostic fu I can come up with, and I don't see why this is happening.
I used SysInternals ProcessMonitor to check to see if I manually loaded "log4j.properties" or "log4j.xml". None found.
I made Ant turn on verbose class loading, and I never saw it load either "log4j.properties" or "log4j.xml". This tells me this wasn't passed to forked processes, because I know the "cobertura.jar" has a "log4j.properties", which has the following contents:
# set default logging level and appender
log4j.rootCategory=WARN, console
#log4j.category.net.sourceforge.cobertura=WARN, console
#log4j.category.net.sourceforge.cobertura.check=DEBUG, console
#log4j.category.net.sourceforge.cobertura.coverage=DEBUG, file
#log4j.category.net.sourceforge.cobertura.coverage.CoverageDataFactory=INFO, file
#log4j.category.net.sourceforge.cobertura.coverage.SaveInstrumentationTimer=DEBUG, file
#log4j.category.net.sourceforge.cobertura.merge=DEGUG, console
#log4j.category.net.sourceforge.cobertura.reporting=DEBUG, file
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-6p %M, %m%n
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=cobertura.log
log4j.appender.file.MaxFileSize=3000KB
log4j.appender.file.MaxBackupIndex=3
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %-2p [%t] %c{3} - %m - (%F:%L) %n
The only irrelevant problem in here is the misspelled "DEGUG", but that's commented out.
I can't see how else this is happening. I've been asking one of the Cobertura maintainers, and he doesn't see why this might be happening.

I figured it out. I had forgotten about the very handy "log4j.debug" property, which when enabled tells you where it found a "log4j.xml" or "log4j.properties" file. I found the former in an unexpected jar file, which I've now patched (it was setting the default level to DEBUG), and now I'm not getting debug output by default.

Related

Where do I save the log4j.properties file so that RedhawkSDR will automatically find it

I've compiled RedhawkSDR v3.0.0 within a Docker container and tried to implement the Basic Sandbox Example from RedhawkSDR's manual (Manual for v3.0.0 & v3.0.1). However, I've encountered this problem, as shown below:
$ docker run -it docker-redhawk3.0.0-src
[root#2c65bf0659d7 Redhawk_User]# python3
Python 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ossie.utils import sb
>>> sb.catalog()
['rh.AmFmPmBasebandDemod', 'rh.ArbitraryRateResampler', 'rh.DataConverter', 'rh.FileReader', 'rh.FileWriter', 'rh.HardLimit', 'rh.RBDSDecoder', 'rh.SigGen', 'rh.SinkSDDS', 'rh.SinkVITA49', 'rh.SourceSDDS', 'rh.SourceVITA49', 'rh.TuneFilterDecimate', 'rh.agc', 'rh.autocorrelate', 'rh.fastfilter', 'rh.fcalc', 'rh.psd', 'rh.psk_soft', 'rh.sinksocket', 'rh.sourcesocket']
>>> sigGen = sb.launch("rh.SigGen")
>>> hardLimit = sb.launch("rh.HardLimit")
>>> sb.IDELocation("/eclipse")
>>> plot = sb.Plot()
>>> sigGen.connect(hardLimit)
>>> hardLimit.connect(plot)
>>> log4j:WARN No appenders could be found for logger (jacorb.config).
log4j:WARN Please initialize the log4j system properly.
Plotter: Cannot open display:
(Note: The error takes about 5 sec to appear, which is why the >>> prompt appears before the error message.)
I've Googled this error and found a relevant StackOverflow entry(No appenders could be found for logger(log4j)?). I also looked at the section on logging in the Redhawk Manual(RedhawkSDR-LoggingConfig). I got the impression that if I created a file called log4j.properties and either indicated where it was by including it in the Java CLASSPATH environment variable, or placed it in the directory with the log4j jar files, then this error would be resolved.
A reasonable default for this file was given as: (Note: Multiple answers in StackOverflow had the bottom formatted string without quotes, but the Redhawk version used quotes. I tried with & without, but without success):
# Root logger option
log4j.rootLogger=INFO, stdout
# Direct log messages to stdout
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 %c{1}:%L - %m%n
However, adding this file in both locations did not solve the problem. I also tried adding the directory with log4j jar files to the CLASSPATH variable, but without success.
logAt this point, I don't know what to do. How can I fix the log4j errors? How can I open the plotter? Is the plotter not opening a function of the log4j errors or does it have something to do with my use of Docker?

"Unexpected error running Liquibase: Unknown Reason" liquibase 3.3.5 and grails war file

This is the command I am running:
java -jar /root/liquibase/liquibase.jar \
--driver=com.mysql.jdbc.Driver \
--logLevel=debug \
--changeLogFile=migrations/changelog.xml \
--classpath=/usr/share/tomcat7/lib/mysql.jar:/var/lib/tomcat7/webapps/myApp.war \
--url="jdbc:mysql://127.0.0.1:3306/mydb" \
--username=myuser \
--password=mypass \
--contexts=MYCONTEXT \
update
this fails with the following unhelpful error message:
Unexpected error running Liquibase: Unknown Reason
SEVERE 9/9/15 2:23 PM: liquibase: Unknown Reason
java.lang.AbstractMethodError
at liquibase.database.DatabaseFactory.register(DatabaseFactory.java:87)
at liquibase.database.DatabaseFactory.<init>(DatabaseFactory.java:29)
at liquibase.database.DatabaseFactory.getInstance(DatabaseFactory.java:40)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:50)
at liquibase.integration.commandline.Main.doMigration(Main.java:884)
at liquibase.integration.commandline.Main.run(Main.java:175)
at liquibase.integration.commandline.Main.main(Main.java:94)
I have no idea where to look. I have verified that the jars and wars are correct, i.e.
ls /root/liquibase/liquibase.jar
ls /usr/share/tomcat7/lib/mysql.jar
ls /var/lib/tomcat7/webapps/revolve.war
All list the corresponding file.
Any ideas?
the war exploded looks like this:
WEB-INF\classes\migrations\
changelog.xml
lots_of_other_changes.xml
WEB-INF\classes\migrations\sql
lots of sql files
I have tired lots of variations, including:
--changeLogFile=WEB-INF/classes/migrations/changelog.xml \
the changelogs work find if I run them on my local pc outside of a war file, although I do have to cd into the directory where the main changelog.xml file is first, otherwise it does not work.
The main changelog looks like this:
<databaseChangeLog
:
<include file="baseline.xml"/>
<include file="something.xml"/>
and these included files have things like this:
<changeSet id="something" author="me">
<comment>something</comment>
<sqlFile path="sql//something//new_things.sql" />
</changeSet>
NOTE:
using the grails in-application auto-updater feature with the data-migration 1.4.0 plug wont work, as it is hard coded to use liquibase version 2.0.5 which has major bugs.
using liquibase 3.4+ is not currently an option due to incompatibility.
If I try the command without including the war file location, I correctly get an error saying could not find the changelog file expected, and it creates the DATABASECHANGELOCK table in the db (so that side is ok)
No matter what I change changeLogFile ot, it always gives this error, even something completely wrong.
We dont want to go through the pain of generating diff sql, and running that sql.
I suspect the issue is to do with the relative paths of the includes in the change sets.
I also tried changing all the
<include file="something.xml"/>
to
<include file="something.xml" relativeToChangelogFile="true" />
and
<sqlFile path="sql//something//new_things.sql" />
to
<sqlFile relativeToChangelogFile="true" path="sql//something//new_things.sql" />
But this made no difference - same error. I tried exploding the war and running it on the exploded files - this works, but is not what we want (as there is no way to explode the war on the production machines - they dont have the jar command, and if we deploy the war to live servers, without the DB changes first, the live system will fail)
I don't know about Grails, but I'm immediately noticing those doubled-slashes in your paths. I would expect them to cause problems.
Are you perhaps thinking of the need to quote Windows-style backslashes? Where you see things like: C:\\path\\to\\file.dat.
But you don't need to do that for Unix-style slashes (or forward-slashes, if you will). (And if you did you'd still have to quote them with backslashes, like this: \/path\/to\/file.dat -- but don't do that.)
I have the same situation: using LiquiBase with a Grails application. I had to fall back to liquibase-core-2.0.5.jar, which is embedded in the Grails User Library. I could not figure out how to exclude the jar. Unfortunately, this version of LiquiBase is considered very buggy.

Integrate Specs2 results with Jenkins

I want to integrate the Specs2 test results with Jenkins.
I was added the below properties in sbt:
resolver:
"maven specs2" at "http://mvnrepository.com/artifact"
libraryDependencies:
"org.specs2" %% "specs2" % "2.0-RC1" % "test",
System Property:
testOptions in Test += Tests.Setup(() => System.setProperty("specs2.outDir", "/target/specs2-reports")) //Option1
//testOptions in Test += Tests.Setup(() => System.setProperty("specs2.junit.outDir", "/target/specs2-reports")) //Option2
testOptions in Test += Tests.Argument(TestFrameworks.Specs2, "console", "junitxml")
If I run the below command, it is not generating any specs reports in the above mentioned directory("/target/specs2-reports").
sbt> test
If I run the below command, it is asking for the directory as shown in the below error message:
sbt> test-only -- junitxml
[error] Could not run test code.model.UserSpec: java.lang.IllegalArgumentException: junitxml requires directory to be specified, example: junitxml(directory="xxx")
And it is working only if I give the directory as shown below:
sbt> test-only -- junitxml(directory="\target\specs-reports")
But sometimes its not generating all the specs report xmls (some times generating only one report, sometimes only two reports etc.).
If I give test-only -- junitxml(directory="\target\specs-reports") in the jenkins it is giving the below error.
[error] Not a valid key: junitxml (similar: ivy-xml)
[error] junitxml(
[error] ^
My main goal is, I want to generate the consolidated test reports in junit xml format and integrate with Jenkins. Kindly help me to solve my problem.
Best Regards,
Hari
The option for the junitxml output directory is: "specs2.junit.outDir" and the default value is "target/test-reports".
So if you don't change anything you could just instruct Jenkins to grab the xml files from "target/test-reports" which is what I usually do.
Also you might have to enclose your sbt commands in Jenkins with quotes. This is what I typically do:
"test-only -- html junitxml console"

Openbravo ant build fails

I am trying to setup openbravo on eclipse environment with the above URL.
Development stack setup is done successfully. (ANT, Java, Postgresql)
At the openbravo source directory when i apply the command
ant install.source
Build failure due to errors -
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/build.xml:480: The following error occurred while executing this line:
480 <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/src/build.xml:874: The following error occurred while executing this line:
874 <jvmarg line="${env.CATALINA_OPTS}" />
/home/pos/sourcecode_openbravo/Openbravo-3.0MP21/src/build.xml:880: Directory
880 <jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not successful for an unknown reason
Any help would be appreciated. Thanks.
Sounds like a permission problem.
See the related section 'Permission issues' in openbravo wiki
EDIT
for the remaining issues, i believe the properties base.src, CATALINA_OPTS and CATALINA_BASE are not set properly. Check this via :
<echo>
$${base.src} => ${base.src}
$${env.CATALINA_OPTS} => ${env.CATALINA_OPTS}
$${env.CATALINA_BASE} => ${env.CATALINA_BASE}
</echo>
or simply output all available properties use :
<echoproperties/>
also consider, before using ${env.whatever} you need to use :
<property environment="env"/>
before !
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not successful for an unknown reason
Give the permission to webapps folder
sudo chmod -R 777 /var/lib/tomcat6/webapps/
/var/lib/tomcat6/webapps/openbravo/WEB-INF/lib creation was not
successful for an unknown reason
it seem permission problem. It is important to always us the correct user account to start / stop tomcat!
Conceptually there are two user accounts involved in working with Openbravo:
command-line user used to work with files & compile Openbravo
user account used by Apache Tomcat service
There are several overlapping areas in which one of the accounts needs to access and modify files from the other account in both directions.
To avoid any problems Openbravo strongly recommends to run Apache Tomcat services with the same user account which is used on command line. As that way the above topic will be perfectly solved easily.
source: http://wiki.openbravo.com/wiki/Installation/Custom/Apache_Tomcat

CVS error - CVS exited with error code 1

I am seeing this error for quite sometime now.
I am running ant build on CYGWIN which inturn runs on WindowsXP.
The resolution(bad one) I found was to delete my gcct/first directory and run ant build again (which runs from another directory). It runs successfully but if I modify some code under gcct/first, I do not want to delete it because of this error.
I did see this link. The resolution here does not apply to me since I do not have .cvspass defined anywhere in the build.xml.
C:\svn\CEL_v3681\buildCore.xml:1883: cvs exited with error code 1
Command line was [Executing 'cvs' with arguments:
'checkout'
'-A'
'-rfirst_v2_126'
'gcct/first'
The ' characters around the executable and arguments are
not part of the command.
environment:
ALLUSERSPROFILE=C:\Documents and Settings\All Users
ANT_HOME=C:/Apps/Apache/apache-ant-1.7.0
APPDATA=C:\Documents and Settings\shankarc\Application Data
CLASSPATH=./;C:/Program Files/Java/jre1.5.0_07/lib/ext/QTJava.zip
COMMONPROGRAMFILES=C:\Program Files\Common Files
COMPUTERNAME=NYKPWM2035798
COMSPEC=C:\WINNT\system32\cmd.exe
CUSTPROF=Roaming700Live
CVSROOT=:pserver:shankarc#amcvs2.lehman.com:/home/eqcvs/cmte
CVS_RSH=/bin/ssh
FP_NO_HOST_CHECK=NO
HOME=C:\Apps\CYGWIN\home\shankarc
HOMEDRIVE=F:
HOMEPATH=\
HOSTNAME=nykpwm2035798
IDEA_PROPERTIES=C:\Documents and Settings\shankarc\idea.properties
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
JAVA_HOME=C:/Program Files/Java/jdk1.6.0_21/
JDK_HOME=C:\Program Files\Java\jdk1.6.0_21\
LOGONSERVER=\\NYKPSM00069
MANPATH=/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
PATH=C:\Apps\CYGWIN\usr\local\bin;C:\Apps\CYGWIN\bin;C:\Apps\CYGWIN\bin;C:\Apps\CYGWIN\usr\X11R6\bin;C:\Apps\Apache\apache-ant-1.7.0\bin;C:\Program Files\Java\jdk1.6.0_21\bin\;C:\Apps\CYGWIN\bin;C:\Program Files\VisualSVN Server\bin;C:\Program Files\Sudowin\Clients\Console;C:\Program Files\Fortify Software\Fortify 360 v2.5.0\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
PRINTER=\\NYKPSM04020\NYKLPR1301-03-03C05
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 6, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f06
PROFGROUP=FONP
PROGRAMFILES=C:\Program Files
PROMPT=$P$G
PWD=/cygdrive/c/svn/CEL_v3681/gcct/cel
QHOME=c:\q
QTJAVA=C:\Program Files\Java\jre1.5.0_07\lib\ext\QTJava.zip
SESSIONNAME=Console
SHLVL=1
SITECODE=NYK
SITEIDENT=NYK
SVN_ASP_DOT_NET_HACK=1
SYSTEMDRIVE=C:
SYSTEMROOT=C:\WINNT
TEMP=C:\TEMP
TERM=cygwin
TMP=C:\TEMP
UATDATA=C:\WINNT\system32\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77
USER=shankarc
USERDNSDOMAIN=INTRANET.BARCAPINT.COM
USERDOMAIN=INTRANET
USERNAME=shankarc
USERPROFILE=C:\Documents and Settings\shankarc
WINDIR=C:\WINNT
CVS_PASSFILE=C:\Apps\CYGWIN\home\shankarc\.cvspass]
Total time: 58 seconds
How I resolve this?
I had the same issue and found that even though I was not using .cvspass I did have a build property of cvs.pass set which needed to be reset to OVERRIDE to function depending on how you set up your cvs access (though it looked similar from your post). This needed to be changed in build.properties and .build.properties. Hope this helps!

Resources