Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to use tinylog in Eclipse plugin(thirdparty logging lib not working)
How to use tinylog in Eclipse plugin [message #1826627] Tue, 28 April 2020 00:19 Go to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
I am writing an Eclipse plugin and want to use tinylog in my plugin code. I tried this:

1). modified Eclipse config file (eclipse.ini) to add this line: -Dtinylog.configuration=C:\eclipse-cpp-2018-09-win32-x86_64\eclipse\tinylog.properties

2). content of tinylog.properties:

writer = file
writer.level = debug
writer.file = C:\eclipse-cpp-2018-09-win32-x86_64\eclipse\log.txt
writer.charset = UTF-8
writer.append = true
writer.buffered = true

In fact, not just tinylog in my plugin. I tried umlet Eclipse Plugin (https://www.umlet.com/. The plugin uses slf4j API and lib. I made its logging stmt executed (verified by JOptionPane popup). I couldn't find and file being created.
Re: How to use tinylog in Eclipse plugin [message #1826628 is a reply to message #1826627] Tue, 28 April 2020 00:49 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

What is tinylog, and where is its documentation and forum? This one isn't really for general programming questions or third party libraries.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to use tinylog in Eclipse plugin [message #1826631 is a reply to message #1826628] Tue, 28 April 2020 03:15 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
tinylog is a thirdparty lib (https://tinylog.org/v2/).
Re: How to use tinylog in Eclipse plugin [message #1826666 is a reply to message #1826631] Tue, 28 April 2020 13:59 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

It looks like https://tinylog.org/v2/support/ directs you to Stack Overflow.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to use tinylog in Eclipse plugin [message #1826687 is a reply to message #1826666] Wed, 29 April 2020 00:54 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
that's true but tinylog people seems they don't know Eclipse plugin very well. Not much help from there although I tried. Here I'd like to get direct advice on problem itself although more channels information is also good.

My same help request there if anyone want to check first:

https://stackoverflow.com/questions/61318315/how-to-use-tinylog-in-eclipse-plugin

[Updated on: Wed, 29 April 2020 01:28]

Report message to a moderator

Re: How to use tinylog in Eclipse plugin [message #1826693 is a reply to message #1826687] Wed, 29 April 2020 05:54 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4434
Registered: July 2009
Senior Member

Does it work when you use those properties in a normal Java application?

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: How to use tinylog in Eclipse plugin [message #1826752 is a reply to message #1826693] Thu, 30 April 2020 01:21 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
yes. not only works, but also very good. recommended!
Re: How to use tinylog in Eclipse plugin [message #1826753 is a reply to message #1826752] Thu, 30 April 2020 03:34 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Just to be sure, you added the line -Dtinylog.configuration=C:\eclipse-cpp-2018-09-win32-x86_64\eclipse\tinylog.properties after the line with -vmargs on it? You've tested that System.getProperty("tinylog.configuration") returns the value you've configured?

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to use tinylog in Eclipse plugin [message #1826764 is a reply to message #1826753] Thu, 30 April 2020 07:39 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
According to my test, slf4j logging does not work in Eclipse plugin neither(https://github.com/umlet/umlet/issues/581). Looks like thirdparty logging lib usage in Eclipse plugin could be a pioneer effort.
Re: How to use tinylog in Eclipse plugin [message #1826765 is a reply to message #1826764] Thu, 30 April 2020 07:53 Go to previous messageGo to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
I don't know what you've tryied, but SLF4J can actually be used in an Eclipse plugin, see this article on Vogella: https://www.vogella.com/tutorials/EclipseLogging/article.html#slf4j-in-eclipse-applications
Re: How to use tinylog in Eclipse plugin [message #1826766 is a reply to message #1826753] Thu, 30 April 2020 08:03 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
thanks for the suggestion!
eclipse.ini :

-startup
plugins/org.eclipse.equinox.launcher_1.5.100.v20180827-1352.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.800.v20180827-1352
-product
org.eclipse.epp.package.cpp.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dtinylog.configuration=tinylog.properties
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms256m
-Xmx1024m
-Dbundles.configuration.location=configuration
--add-modules=ALL-SYSTEM

I modified my code to use JOptionPane to show
```
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
generateUTSrc(event);
return null;
}


public void generateUTSrc(ExecutionEvent event)
{
JOptionPane.showMessageDialog(null,System.getProperty("tinylog.configuration"));
Logger.debug("generateUTSrc");
....
}
```

please kindly check attached file content.

[Updated on: Thu, 30 April 2020 08:08]

Report message to a moderator

Re: How to use tinylog in Eclipse plugin [message #1826767 is a reply to message #1826765] Thu, 30 April 2020 08:05 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
that's great. then it's UMLet issue. cheers!
Re: How to use tinylog in Eclipse plugin [message #1826837 is a reply to message #1826767] Sat, 02 May 2020 00:28 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
Hope to see further comment/suggestion.
Re: How to use tinylog in Eclipse plugin [message #1827001 is a reply to message #1826837] Wed, 06 May 2020 04:10 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
please refer to latest update in https://stackoverflow.com/questions/61318315/how-to-use-tinylog-in-eclipse-plugin. Ok now.

A small issue is that although I set tinylog to flush immediately but I have to quit Eclipse before I can see log content in my log file. Any possible Eclipse setting I need to do?

[Updated on: Wed, 06 May 2020 04:33]

Report message to a moderator

Re: How to use tinylog in Eclipse plugin [message #1827016 is a reply to message #1827001] Wed, 06 May 2020 07:52 Go to previous messageGo to next message
Emmanuel Chebbi is currently offline Emmanuel ChebbiFriend
Messages: 123
Registered: February 2018
Senior Member
Ming Cheng wrote on Wed, 06 May 2020 06:10
please refer to latest update in https://stackoverflow.com/questions/61318315/how-to-use-tinylog-in-eclipse-plugin. Ok now.

Great, thanks for the update!

Ming Cheng wrote on Wed, 06 May 2020 06:10
A small issue is that although I set tinylog to flush immediately but I have to quit Eclipse before I can see log content in my log file. Any possible Eclipse setting I need to do?

So you have the log file open in an Eclipse editor but the editor is not updated even though the logger writes to the file, right?

A right click on the project > Refresh should do the trick. The issue is likely that Eclipse is never notified of any change in the file because the logger does not use Eclipse's resources API.

For a permanent solution you can force Eclipse IDE to use native polling to watch files (Windows > Preferences > General > Workspace > Refresh using native hooks or polling).
Re: How to use tinylog in Eclipse plugin [message #1827089 is a reply to message #1827016] Thu, 07 May 2020 00:32 Go to previous messageGo to next message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
It does solve the small issue. BTW, what's the Eclipse Resource API doing logging?
Re: How to use tinylog in Eclipse plugin [message #1827091 is a reply to message #1827016] Thu, 07 May 2020 00:33 Go to previous message
Ming Cheng is currently offline Ming ChengFriend
Messages: 19
Registered: December 2019
Junior Member
Should I close this topic and how if should?
Previous Topic:How do I edit a jar file?
Next Topic:eclipse 4.15 don't run on macbookair version mac os x 10.9.5 with java 14.0.1
Goto Forum:
  


Current Time: Fri Apr 19 18:05:10 GMT 2024

Powered by FUDForum. Page generated in 0.09301 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top