Questions tagged [threadcontext]
The threadcontext tag has no usage guidance.
threadcontext
45
questions
949
votes
5
answers
470k
views
What is thread safe or non-thread safe in PHP?
I saw different binaries for PHP, like non-thread or thread safe?
What does this mean?
What is the difference between these packages?
14
votes
5
answers
2k
views
Windows: avoid pushing full x86 context on stack
I have implemented PARLANSE, a language under MS Windows that uses cactus stacks to implement parallel programs. The stack chunks are allocated on a per-function
basis and are just the right size to ...
13
votes
4
answers
17k
views
ExecutionContext of Threads
What's the purpose of ExecutionContext.SuppressFlow();? In the following code what exactly gets suppressed?
I've this test code...
protected void btnSubmit_Click(object sender, EventArgs e)
{
...
8
votes
1
answer
9k
views
What exactly is the thread context in C#?
I have a WCF service and it logs each call to the database. Later on, if an exception occurs, it is also logged to a separate database.
I wanted a way to tie both of these logs together so we can see ...
6
votes
1
answer
5k
views
Why Thread.CurrentContext property and Thread.GetDomain() method?
It's not a question of major importance, but I was wondering why the Thread class exposes a property for getting the current Context (Thread.CurrentContext) and a method for getting the current ...
5
votes
2
answers
9k
views
log4j2 isThreadContextMapInheritable property usage
I am trying to log events of a Java application to separate log files based on a key set to the ThreadContext. But my key is not reaching the child thread (created on MouseEvent) even after setting "...
5
votes
3
answers
4k
views
Pass context to async Logger
I am trying to log raw request/response from a http client.
I am following log4j2 configurations from these logging instructions.
HttpAsync Client Dependency :- httpasyncclient (version 4.1.1)
log4j2....
4
votes
1
answer
6k
views
Alternative to 'ThreadContext' in log4j
I have been working on a project which uses log4j2, and in this project I use ThreadContext. Now I'm back to working with log4j (1), and it doesn't provide ThreadContext. Are there any good ...
4
votes
3
answers
4k
views
Win 64bit GetThreadContext returns zeroe'd out registers, or 0x57 errorcode
I'm working on a Windows 7 64 bit machine (I have admin privs).
I'm using Python 2.7 (64-bit) with PyDev ctypes for Eclipse to try and read the values of registers in all threads associated with a ...
3
votes
2
answers
6k
views
Microsoft.AspNetCore.Hosting.Internal.WebHost and log4net.LogicalThreadContext.Properties["requestid"]
I use netcore2.0 and I'm setting log4net.LogicalThreadContext property "requestid" with each request in my middleware class for logging purposes.
log4net.LogicalThreadContext.Properties["requestid"] =...
3
votes
3
answers
1k
views
Is Log4net threadContext safe to use with WCF hosted in IIS?
I've read in a few places that the log4net threadContext isn't safe to use in an asp.net scenario. Here are a few articles:
Log4Net, ThreadContext, and Global.asax
http://piers7.blogspot.com/...
2
votes
2
answers
2k
views
Empty Threadcontext braces scenario handling in log4j2
I am trying to migrate to log4j2.
In RollingFile Appender I am adding as below:
<PatternLayout>
<pattern>[%d{MM/dd/yy HH:mm:ss:SSS z}] %-18.18t %-35.35c{1} %-5p (%F:%L) %m \t %x %n&...
2
votes
1
answer
3k
views
GetThreadContext returns EBP = 0
I'm trying to get the value of another process' EBP register on windows7 64 bits.
for this I'm using GetThreadContext like this:
static CONTEXT threadContext;
memset(&threadContext, 0, sizeof(...
2
votes
1
answer
188
views
IoC and thread singletons
Several different IoC containers have support for Thread Singletons.
How do the frameworks know when a thread goes out of scope?
For instance: If I use the Thread Pool to do something, how can the ...
2
votes
1
answer
957
views
ThreadLocal/CoroutineContext bridge gaps
I want to maintain an object at the thread level or the coroutine level depending on the type of work the application is doing across different thread/coroutines. Is there a way to achieve this?
let's ...
2
votes
1
answer
325
views
Teaching gdb to understand micro-threads from core files
I am working on a huge program that employs a (custom built) micro-threading solution. It sometimes happens that I need debug a crash. During such times, it is useful to be able to switch from one ...
1
vote
2
answers
2k
views
How can we create a callcontext for async .net methods?
In a synchronous environment, it is easy to create a scoped context which allows you to attach out-of-band context to your current thread. Examples of this are the current TransactionScope or thread-...
1
vote
1
answer
5k
views
Trust Boundary Violation flaw in Java project
For the below mentioned code, I'm getting Trust Boundary Violation in the CheckMarx report.
Error description -
...
1
vote
2
answers
4k
views
how to insert into database from stored procedure in log4net?
I have to log thread context properties like this:
string logFilePath = AppDomain.CurrentDomain.BaseDirectory + "log4netconfig.xml";
FileInfo finfo = new FileInfo(logFilePath);
log4net.Config....
1
vote
1
answer
4k
views
java.lang.NoSuchMethodError: org.apache.logging.log4j.ThreadContext.getThreadContextMap()
I have a spring mvc application with log4j 2.9.1. It used to work fine, but all of a sudden, I get
Caused by: java.lang.NoSuchMethodError: org.apache.logging.log4j.ThreadContext.getThreadContextMap()...
1
vote
1
answer
4k
views
Setting & Getting Values from ThreadContext in log4j2
I am using log4j-api-2.0-beta4.jar along with sl4j in my web-app.
I am trying to insert some values into ThreadContext.
ThreadContext.put("user",userName); ThreadContext.put("thread",...
1
vote
1
answer
280
views
Can we set the characters limited to 10 characters in log4net %property?
This is my threadContext exception message property
log4net.ThreadContext.Properties["excmessage"] = ex.Message;
I want to get the first 10 characters of exception message property using log4net.
...
1
vote
0
answers
287
views
Using ThreadContext instead of HttpContext?
I have a 3 tiered architecture (Controller/Service/Repository) as well as a Domain for models that all layers will need. Each layer includes the domain, and each layer includes it's "parent" layer. So ...
1
vote
1
answer
226
views
Jruby thread context instance association
I am trying to eval javascript in ruby.
config/initializer/initializer_context.rb
js_str =
EXEC_PP_CONTEXT = ExecJS.compile("function test_add(param) { return param.a+ param.b;}")
and then in ...
1
vote
1
answer
1k
views
Segmentation fault after swapcontext in alarm handler
Basically what I am trying to do is simulate multithreading on a single thread with context switching. I set up an alarm for every 10 microseconds, and I switch the context from one to another thread. ...
1
vote
0
answers
123
views
How do you map the thread context when integrating a WCF service and the service bus
I'm building an azure application with a windows client, a wcf service and a worker role on azure that handles a lot of back ground processing. In some cases I need the wcf service to hand over a task ...
0
votes
1
answer
2k
views
In asp.net core controller, why does ExecutionContext.SuppressFlow() throw "AsyncFlowControl object must be used on the thread where it was created."
I am attempting to suppress the flow of the execution context across asynchronous threads. I've written below code, but it throws an error -
InvalidOperationException: AsyncFlowControl object must ...
0
votes
1
answer
2k
views
Log4j ThreadContext from child thread
I'm using with Log4J2 and ThreadContext and basically, I want the ThreadContext shared across all threads (or an alternative to ThreadContext, as the name seems to imply it should be thread-specific).
...
0
votes
1
answer
171
views
How to use RequestContext custom attributes of armeria in log4j2.xml configuration?
I'm using log4j2 2.14.0 with armeria 1.3.0. According to the armeria documentation, I could see RequestContext custom atrributes can be exported using com.linecorp.armeria.common.logback....
0
votes
1
answer
1k
views
Not getting ThreadContext values even after setting "isThreadContextMapInheritable" to true, using Vert.x and Log4j2
I am using Vertx and Log4j2.
This is the code for Remote.java
public class Remote extends AbstractVerticle {
@Override
public void start() throws Exception {
System.setProperty("...
0
votes
1
answer
372
views
How to share data between different threads which belong to different classes?
I was reading about async/await recently and I would like to know how to share data between different threads which belong to different classes? Let's assume that we have the HttpContext in some web ...
0
votes
2
answers
2k
views
How to properly save and restore thread context on 64 bit process (Windows)?
I've got this code below for releasing library from some 64 bit process. It does its job, but the problem is that after restoring saved context, the target process just crashes. Dunno what is the ...
0
votes
0
answers
42
views
Can I make all log fields (contextMap) of java logger to be in the same hierarchy?
I am trying to make my logs standardized, and I am using the ThreadContext in java logger.
I have the output of {"timestamp":..., "message":"...", "contextMap":{...
0
votes
1
answer
634
views
How to transfert some of the ThreadContext values in a thread created by ScheduleExecutorService?
I use Executor.newSingleThreadScheduled Executor() to do a very simple repetitive task which works great.
But because it is in another thread, I lose the correlation_Id that is in my ThreadContext and ...
0
votes
0
answers
672
views
ThreadContext leaking between requests even after over defensive clean up
We are using org.apache.logging.log4j.ThreadContext in a default scoped bean to store user properties in the span of the request. This is from the package : log4j-api-2.12.1.jar.
While making API ...
0
votes
1
answer
701
views
Log4j2 migration - how to pass username param to appender in every LoggingEvent / LogEvent [duplicate]
I need to get a username parameter to my ConsoleAppender in every LoggingEvent (or LogEvent in log4j2).
How can I recreate this implementation of altering the doAppend method of my ...
0
votes
0
answers
148
views
log4j2 - Can one appender manage more than 1 file "simultaneously"?
I want to create an appender that logs each user actions into a different file per user using the MDC / ThreadContext to save the user name and use it to name the file later on.
So for User1 we'd have ...
0
votes
1
answer
465
views
How to make request header available in rxJava threads? Injecting HttpServletRequest in a new thread does not work
I am working on a Spring boot application and need to read request header in a RxJava thread, but injecting HttpServletRequest doesn't work because of a new thread. Passing header from current thread ...
0
votes
1
answer
195
views
How can I show OrderId on log text as Log4j pattern layout
I'm having trouble getting a log message to display the right way. I'm using this Log4J pattern layout:
pattern="ORDERID : $${ctx:ORDERID} %msg%n"
I want to see output like:
ORDERID: 123 Test ...
0
votes
1
answer
1k
views
Unable to create multiple log files based on the ThreadContext map values using routing appender in log4j2
I'm using the log4j2 jars in the oracle adf application build on 12c.
Requirement: Create multiple log files based on the session and ability to change the logging properties dynamically.
Log4j2.xml ...
0
votes
1
answer
475
views
Async ThreadContext ID
UPDATE Not a Problem now. Didn't realize the theadID returned inside and outside the Dispatcher.Invoke method are different.
From my understanding, when using async, the awaiting task T1 will be ...
0
votes
1
answer
783
views
Thread information of intercepting method Spring AOP
Is there a way to find out the thread information of the method which AOP intercepts, using some sort of around advice? E.g if my around advice is intercepting a login method, is there a way to obtain ...
0
votes
1
answer
344
views
how one thread can be killed in another thread
Actually,the main scenerio is that : from main thread there are two thread running.By using conditional variable,two threads will be running and sleeping and then it will return to main thread.I mean ...
-1
votes
1
answer
96
views
How does the shared engine look up the required resources for a process step invocation?
I am using a shared process engine on WebSphere and I want to understand how the engine looks up the required resources (custom code shipped with my process application) for a process step invocation. ...
-1
votes
3
answers
551
views
How an OS figures out an identity of a thread calling the GetCurrentThreadId()?
I'm trying to understand how an OS figures out what thread is a current one (for example, when the thread calls gettid() or GetCurrentThreadId()). Since a process address space is shared between all ...