Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] How to disable jgit debug messages when using it via ant

Am 2020-06-05 13:58, schrieb Matthias Sohn:

Hi Matthias!

Thank you for your help! Meanwhile I found out, that jgit 5.4.0.201906121030-r (which is used in the examples of https://github.com/elab/jgit-buildnumber) doesn't generate these much log messages and prints four lines only. Upgrading jgit to 5.4.2 or later spits out hundreds of DEBUG messages again. I could live with 5.4.0 and this version runs fine on my local PC, but unfortunately it crashes on Jenkins for some reason:

jgit-buildnumber:
[extract-buildnumber] 00:26:45.357 [main] DEBUG org.eclipse.jgit.util.FS - FileStoreAttributeCache[FileStore[(D:)]: fsTimestampResolution=PT0.007579S]

BUILD FAILED
D:\JenkinsWork\tools\src\myTool\build\build.xml:81: java.lang.NullPointerException at org.eclipse.jgit.util.FS$FileStoreAttributeCache.getFsTimestampResolution(FS.java:203)
	at org.eclipse.jgit.util.FS.getFsTimerResolution(FS.java:321)
at org.eclipse.jgit.internal.storage.file.FileSnapshot.<init>(FileSnapshot.java:186) at org.eclipse.jgit.internal.storage.file.FileSnapshot.save(FileSnapshot.java:122) at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:156) at org.eclipse.jgit.internal.storage.file.FileRepository.loadUserConfig(FileRepository.java:256) at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:204) at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:612)
	at org.eclipse.jgit.api.Git.open(Git.java:124)
	at org.eclipse.jgit.api.Git.open(Git.java:104)
at com.labun.buildnumber.BuildNumberExtractor.<init>(BuildNumberExtractor.java:96) at com.labun.buildnumber.JGitBuildNumberAntTask.execute(JGitBuildNumberAntTask.java:43)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:155)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
	at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
	at org.apache.tools.ant.Task.perform(Task.java:350)
	at org.apache.tools.ant.Target.execute(Target.java:449)
	at org.apache.tools.ant.Target.performTasks(Target.java:470)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1391)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1254)
	at org.apache.tools.ant.Main.runBuild(Main.java:830)
	at org.apache.tools.ant.Main.startAnt(Main.java:223)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

Total time: 1 second

I'll try to solve that issue by contacting the author. Thank you!


Best regards,
Sven


On Fri, Jun 5, 2020 at 11:01 AM Sven Lübke
<sven.luebke@xxxxxxxxxxx> wrote:

Dear jgit developers!

I'm using jgit to automatically create some git manifest
attributes
within my project via the following ant task

<target name="jgit-buildnumber" depends="retrieve">
<taskdef name="extract-buildnumber"
classname="com.labun.buildnumber.JGitBuildNumberAntTask"

this task isn't part of the jgit project, found this here
https://github.com/alx3apps/jgit-buildnumber

classpathref="dependencies" />
<extract-buildnumber verbose="false"
buildNumberFormat="branch +
'.' + commitsCount + '/' + commitDate + '/' + shortRevision +
(dirty.length > 0 ? '-' + dirty : '')"/>
</target>

This is working without any error. But I'm getting a LOT of these
messages:

[extract-buildnumber] 01:38:09.759
[ForkJoinPool.commonPool-worker-1]
DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot -


file=D:\JenkinsWork\tools_pipeline_branch\workspace\.git\.probe-5fc62af0-343e-44c9-95fd-e9d8201526ce,

create new FileSnapshot: lastRead=2020-06-05 01:38:09.759000000,
lastModified=2020-06-05 01:38:09.759024000, size=1,
fileKey=java.lang.Object@4a891c97
[extract-buildnumber] 01:38:09.759
[ForkJoinPool.commonPool-worker-1]
DEBUG org.eclipse.jgit.internal.storage.file.FileSnapshot -

file=D:\JenkinsWork\tools_pipeline_branch\workspace\.git\.probe-5fc62af0-343e-44c9-95fd-e9d8201526ce,

is racily clean

Running this ant task from within eclipse produces 70KB of log
messages
for one small git project. Calling ant via commandline (Jenkins)
produces ~4MB of log messages.

How can I disable these messages? Is class
"com.labun.buildnumber.JGitBuildNumberAntTask" responsible for
that?
Currently I don't know where to start looking for it, as I
searched for
and tried nearly everything. Looking at the sourcecode at


https://github.com/eclipse/jgit/blob/18050b569f9836e67df43ef66e78ace6ca9815d1/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java#L238
it seems that LOG is set to DEBUG mode everytime.

Thank you for your help and sorry in case this is not the right
mailing
list for my question!

JGit uses the slf4j logging API, org.eclipse.jgit and
org.eclipse.jgit.ant to not include any logging implementation

I meant: do not include any logging  implementation

and corresponding logging configuration. This probably comes either
from the above task implementation or
is part of Ant itself.

-Matthias


Back to the top