instrumentation

What information should I be logging in my web app?

天涯浪子 提交于 2019-12-04 11:26:30
问题 I finishing up a web application and I'm trying to implement some logging. I've never seen any good examples of what to log. Is it just exceptions? Are there other things I should be logging? What type of information do you find useful for finding and fixing bugs. Looking for some specific guidance and best practices. Thanks Follow up If I'm logging exceptions what information specifically should I be logging? Should I be doing something more than _log.Error(ex.Message, ex); ? 回答1: Here is my

Delay (approx 200 ms) in streamed audio playback

限于喜欢 提交于 2019-12-04 10:34:37
I have an application which plays the streamed audio data (like a chat client). The workflow involves three simple steps: The file header info (sample rate, bits per sample and num of channels) is sent first. Audio waveout device is initialized based on the above parameters. Audio (pcm) data is sent and is played on the above device. The data receiving code is native (C code). and it reads data on a socket. Then it calls the managed C# code, which uses Naudio library to initialize device and play audio. Now the problem is that, I am seeing some delay in audio playback. I have already

Cobertura : how to cover spring-data @Repository interfaces

爷,独闯天下 提交于 2019-12-04 03:51:13
Regarding following information : https://stackoverflow.com/a/14601831/704246 Cobertura does not instrument interfaces I'd like to know how to add spring-data interfaces to coverage results, since @Repository implementation classes are only declared and instantiated by Spring at runtime. Consider following interface : // src/main/java/my/package/MyObjectRepository.java @Repository public interface MyObjectRepository { MyObject findMyObjectByCodeAndName(String code, String name); } and following test : // src/test/java/my/package/MyObjectRepositoryTest.java // @RunWith(SpringJUnit4ClassRunner

Ignoring report generation for specific classes in cobertura maven plugin

混江龙づ霸主 提交于 2019-12-04 02:25:25
I've been using Cobertura plugin for report generation and instrumentation (with surefire). Here is the issue I am facing: I am unable to make the plugin ignore report generation for specific classes in my project. PF below the related excerpt from pom.xml, I have added the ignore tag, but that just ignores instrumentation for the ignored classes. I want the report for specific projects to not be generated at all. Firstly, due to my limited knowledge of both Maven and Conberture, I want to know is it possible, and if yes, then what are the changes I need to get done in pom.xml. pom.xml <report

Difference between ActivityUnitTestCase and ActivityInstrumentationTestCase2

天大地大妈咪最大 提交于 2019-12-03 22:19:07
I am new to Android Instrumentation cases. i have been looking at the API samples and see that sometimes we use ActivityUnitTestCase and the ActivityInstrumentationTestCase2. What is the difference between the two ? When would we use one over the other ? See the difference discussed here: http://www.vogella.com/articles/AndroidTesting/article.html#activity_testing Key points: ActivityUnitTestCase can be used for testing layout and isolated methods. ActivityInstrumentationTestCase2 can be used when you want to send touch/mouse events and to test state management.

Detecting System.setProperty method invocations

流过昼夜 提交于 2019-12-03 20:18:20
I'm facing a conundrum here. One of the applications that I've developed is loading an incorrect implementation of the DocumentBuilderFactory class of JAXP. This behavior was later deduced to be resulting from another class in different application built by a different team/company. The said class had changed the preferred DocumentBuilderFactory class upon loading, by inclusion of a static block similar to the one below: static { System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "a new factory"); } If one goes by the Javadocs of the DocumentBuilderFactory.newInstance method, it

Calculating byte-size of Java object [duplicate]

眉间皱痕 提交于 2019-12-03 17:02:45
问题 This question already has answers here : In Java, what is the best way to determine the size of an object? (25 answers) Closed 4 years ago . I am working on calculaitng the size [memory used] of a java object [hashmap] . It contains elements of different data types [at runtime] so [ no-of-elem * size-of-element] is not that good an approach. The code right now does it by series of if (x) do something else if (primitives) lookup size and calculate However this process is a CPU hog and in

native java bytecode instrumentation

孤者浪人 提交于 2019-12-03 16:36:53
for bytecode instrumentation in java, there is the asm framework and the bcel and javaassist libraries. However I need to do instrumentation in native code, since some java classes are already loaded by the time the javaagent runs, eg java.lang.Thread, java.lang.Class, etc is there any library for instrumenting java classes in native code? Edit: Seems there is a bit of confusion. What I want is: Create a native java agent, which uses JVMTI apis to change the bytecode of a class while its being loaded, using the OnClassLoad event hook. I encountered this problem during my doctoral research. The

Java NoClassDefFoundError when calling own class from instrumented method

落爺英雄遲暮 提交于 2019-12-03 15:11:33
问题 I am working on a kit of simple Java agents to help me (and hopefully others) troubleshoot Java applications. One of the agents I would like to create instruments the JComponent.getToolTipText() method to quickly identify any GUI class by just hovering the mouse cursor over it. You can find the code of my transformer and the rest of the project here: http://sfn.cvs.sourceforge.net/viewvc/sfn/core/src/main/java/org/leplus/sfn/transformer/JComponentTransformer.java?view=markup I launch my test

Error while instrumenting class files (asm.ClassWriter.getCommonSuperClass)

天涯浪子 提交于 2019-12-03 14:19:36
问题 Getting error on instrumentation java.lang.RuntimeException: java.lang.ClassNotFoundException: Deposit at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source) at org.objectweb.asm.ClassWriter.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.Frame.a(Unknown Source) at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source) at com.jConSequence.instrumentor.methodProber.AdddataBaseDetailsInstructions$AdddataBaseDetailsMethodInstructions.visitMaxs