Re: [MarkLogic Dev General] Logging Java Api

2017-05-19 Thread Sam Mefford
I don't see this code anywhere creating any log files nor connecting the out 
stream to any logging framework.  To see the contents of "out", you'll need to 
write them to a file, or print them to standard out, or connect a logging 
framework to do that for you.  All RequestLogger is trying to do is allow you 
to capture the requests sent to the REST server if that's desirable.  If all 
you need is logging, please use your preferred logging framwork.  We're not 
attempting to be a logging framework, we're attempting to be ready to connect 
with and work in harmony with your preferred logging framework.

Here's and important relevant excerpt from the javadoc summary 
page<https://docs.marklogic.com/javadoc/client/overview-summary.html?hq=slf4j>:

Enabling Logging

We use slf4j<http://www.slf4j.org/manual.html> for logging. This means you can 
choose any slf4j-compliant logging framework such as Logback, AVSL, JDK 
logging, Log4j, or Simple. If you don't know which to choose, we recommend 
Logback since it is a native implementation and the easiest to configure. 
Please follow the instructions on the slf4j website to configure your logging 
framework. It should take no more than 15 minutes. Once your logging framework 
is configured with slf4j, you should be able to see and manage logging from the 
Java-client API. This is especially important for long-running QueryBatcher and 
WriteBatcher jobs.


Sam Mefford
Senior Engineer
MarkLogic Corporation
sam.meff...@marklogic.com
Cell: +1 801 706 9731
www.marklogic.com<http://www.marklogic.com>

This e-mail and any accompanying attachments are confidential. The information 
is intended solely for the use of the individual to whom it is addressed. Any 
review, disclosure, copying, distribution, or use of this e-mail communication 
by others is strictly prohibited. If you are not the intended recipient, please 
notify us immediately by returning this message to the sender and delete all 
copies. Thank you for your cooperation.

From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Andreas Holzgethan 
[andreas.holzget...@ebcont.com]
Sent: Friday, May 19, 2017 3:18 AM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Logging Java Api

We tried different ways:

1.

ByteArrayOutputStream out = new ByteArrayOutputStream();
RequestLogger logger = databaseClient.newLogger(out);
xmlDocumentManager.startLogging(logger);
try {
out.write("Test!".getBytes());
out.flush();
} catch (IOException e) {
e.printStackTrace();
}

DocumentDescriptor e = this.xmlDocumentManager.newDescriptor(this.getUri(id));
StringHandle content = (StringHandle)this.xmlDocumentManager.read(e, (new 
StringHandle()).withFormat(Format.XML));

2.

ByteArrayOutputStream out = new ByteArrayOutputStream();
RequestLogger logger = databaseClient.newLogger(out);
xmlDocumentManager.startLogging(logger);

try {

logger.getPrintStream().write("Test".getBytes());
logger.getPrintStream().flush();
} catch (IOException e) {
e.printStackTrace();
}

DocumentDescriptor e = this.xmlDocumentManager.newDescriptor(this.getUri(id));
StringHandle content = (StringHandle)this.xmlDocumentManager.read(e, (new 
StringHandle()).withFormat(Format.XML));

We also tried to call startLogging after the try catch block.

Once we've also tried to call append instead of write, but we never found 
"Test" in the Logfiles.


Best regards

Andreas Holzgethan

Andreas Holzgethan BSc.
IT Consultant

EBCONT enterprise technologies GmbH
Millennium Tower
Handelskai 94-96
1200 Wien

Mobil: +43 664 606 517 05
Email:andreas.holzget...@ebcont.com<mailto:andreas.holzget...@ebcont.com>
Web:http://www.ebcont-et.com/<http://www.ebcont.com/>
<http://www.ebcont.com/>
OUR TEAM IS YOUR SUCCESS

HG St. Pölten - FN 293731 h
UID: ATU63444589

2017-05-18 18:40 GMT+02:00 Sam Mefford 
<sam.meff...@marklogic.com<mailto:sam.meff...@marklogic.com>>:
Can you please share the code you tried that did not work?

Sam Mefford
Senior Engineer
MarkLogic Corporation
sam.meff...@marklogic.com<mailto:sam.meff...@marklogic.com>
Cell: +1 801 706 9731<tel:(801)%20706-9731>
www.marklogic.com<http://www.marklogic.com>

This e-mail and any accompanying attachments are confidential. The information 
is intended solely for the use of the individual to whom it is addressed. Any 
review, disclosure, copying, distribution, or use of this e-mail communication 
by others is strictly prohibited. If you are not the intended recipient, please 
notify us immediately by returning this message to the sender and delete all 
copies. Thank you for your cooperation.

From: 
general-boun...@developer.marklogic.com<mailto:general-boun...@developer.marklogic.com>
 
[general-boun...@developer.marklogic.com<mailto:general-boun...@deve

[MarkLogic Dev General] Logging Java Api

2017-05-18 Thread Andreas Felix
Hi,
is there a possibility to write own logging entries using the RequestLogger
from the java api?

In the documentation (see https://docs.marklogic.com/guide/java/logging) i
found the info for writing own log entries but it does not work

regards
andreas

-- 

Mit freundlichen Grüßen / Kind regards
*Ing. Andreas Felix*
Senior IT Consultant

*EBCONT enterprise technologies GmbH*

Millennium Tower
Handelskai 94-96
1200 Wien

Mobil: +43 664 606 51 747
Fax: +43 2772 812 69-9
Email: *andreas.fe...@ebcont.com *
Web: http://www.ebcont-et.com/

*OUR TEAM IS YOUR SUCCESS*

HG St. Pölten - FN 293731h
UID: ATU63444589
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general