Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Console Logger not function #29

Open
rogeriomq opened this issue Mar 22, 2017 · 5 comments
Open

Activate Console Logger not function #29

rogeriomq opened this issue Mar 22, 2017 · 5 comments

Comments

@rogeriomq
Copy link

IciqlLogger.activateConsoleLogger();
Not logger in console InteliJ IDE.
iciql version 2.2.0.

@gitblit
Copy link
Owner

gitblit commented Mar 23, 2017

Strange. It should. If you follow the code, that method registers a listener which logs everything to System.out. Are you somehow redirecting System.out?

@rogeriomq
Copy link
Author

System.out is in default.

@gitblit
Copy link
Owner

gitblit commented Mar 23, 2017

This feels like an IDE setup issue. I hate to say Works For Me, but it does... in IntelliJ. Have you stepped through the debugger into the CONSOLE listener to make sure it is actively being called?

@rogeriomq
Copy link
Author

rogeriomq commented Mar 23, 2017

I tested on the linux console itself and nothing!
image
Cities list size is returned.
`
public interface MunicipiosDAO extends Dao {

@SqlQuery("Select * from MUNICIPIOS order by iduf, nome")
Municipios[] allMunicipios();

@SqlQuery("Select * from MUNICIPIOS where id = :id")
Municipios findByPk(@Bind("id") Integer id);

}
`

IciqlLogger.activateConsoleLogger(); BuildDb buildDb = new BuildDb(url); MunicipiosDAO municipiosDAO = buildDb.opendb(MunicipiosDAO.class); System.out.println("Cities list size = " + municipiosDAO.allMunicipios().length); ObservableList<Municipios> list = FXCollections.observableList(Arrays.asList(municipiosDAO.allMunicipios())); municipiosDAO.close(); IciqlLogger.logStats();

@rogeriomq
Copy link
Author

rogeriomq commented Mar 23, 2017

I spent the whole afternoon trying to log in with custom log too and without success! Project Gradle in both netbeans and Inteli J. They did not work. I tested it with Iciql version 2.2.0, 2.1.1 and 2.0.0.
;(

Part of code:
`
String url = "jdbc:h2:"
+ System.getProperties().getProperty("user.dir")
+ System.getProperties().getProperty("file.separator")
+ "template"
+ ";AUTO_SERVER=TRUE;IFEXISTS=TRUE;WRITE_DELAY=0;USER=sa;PASSWORD=test123";
BuildDb buildDb = new BuildDb(url);
Db db = buildDb.getDb();
IciqlLogger.activateConsoleLogger();
IciqlLogger.IciqlListener custom = (type, statement) ->
System.out.println("#####:>[" + type.toString() +"] - " + statement);
IciqlLogger.registerListener(custom);

    List<Municipios> list = db.executeQuery(Municipios.class, "select * from municipios");
    System.out.println("Count cities = " + list.size());
    db.close();

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants