Have configured log4php module with Drupal 7 after trying out with many patches available. Module got successfully installed after following this one https://drupal.org/node/1921258
Still no log in .log file. Tested with basic PHP applications to make sure if log4php is installed properly. It does work with my test application.
No luck with Drupal 7.
Thank you for helping out.
Not sure of why but replacing these lines in log4php.module file
function _log4php_get_path() {
// Check for preferred PEAR installation (or within module directory)
if (file_exists('log4php/Logger.php')) {
$path = 'log4php/Logger.php';
}
elseif (module_exists('libraries')) {
// Use Libraries module, if available
if (file_exists(libraries_get_path('log4php') . '/Logger.php')) {
// check if the library is in the recommended location
$path = libraries_get_path('log4php') . '/Logger.php';
}
elseif (file_exists(libraries_get_path('log4php') . '/src/main/php/Logger.php')) {
// check if the library has been downloaded directly into libraries folder
// this caters for drush make files
$path = libraries_get_path('log4php') . '/src/main/php/Logger.php';
}
}
return isset($path) ? $path : NULL;
}
with this
function _log4php_get_path() {
// Check for preferred PEAR installation (or within module directory)
$path = 'log4php/Logger.php';
return $path;
}
did worked today. Now watchdog events are being logged in .log file.
Related
I recently did a fresh install of CSFML and I am getting this errors when running my program:
object.Exception#source/app.d(38): Fatal error(s) encountered whilst calling `loadSFML()` function:
["Error: libcsfml-system.so, Message: libsfml-system.so.2.5: cannot open shared object file: No such file or directory",
"Error: libcsfml-system.so.2, Message: libcsfml-system.so.2: cannot open shared object file: No such file or directory",
"Error: libcsfml-system.so.2.0, Message: libcsfml-system.so.2.0: cannot open shared object file: No such file or directory"]
I am using SFML D bindings (https://github.com/BindBC/bindbc-sfml):
void loadDyn() {
if (!loadSFML()) {
string[] messages;
foreach (const(ErrorInfo) err; errors) {
string errorStr = to!string(err.error);
string messageStr = to!string(err.message);
messages ~= format("Error: %s, Message: %s", errorStr, messageStr);
}
throw new Exception(format("Fatal error(s) encountered whilst calling `loadSFML()` function: %s", messages));
}
}
void main() {
loadDyn();
sfRenderWindow* renderWindow = sfRenderWindow_create(sfVideoMode(500, 500), "Snake Smooth Dynamics", sfWindowStyle.sfDefaultStyle, null);
sfEvent event;
while (renderWindow.sfRenderWindow_isOpen()) {
while (renderWindow.sfRenderWindow_pollEvent(&event)) {
if (event.type == sfEventType.sfEvtClosed) {
renderWindow.sfRenderWindow_close();
}
}
renderWindow.sfRenderWindow_clear(sfYellow);
renderWindow.sfRenderWindow_drawSprite(snakeHeadSprite, null);
renderWindow.sfRenderWindow_display();
}
}
Things I've tried:
I found someone with a similar question: Linux SFML - Cannot Open Shared Object File, tried out some answers but to no avail
I tried to sudo apt purge every CSFML dependency (graphics, audo, etc) and reinstall each component (csfml-audio, csfml-graphics) manually etc, to no avail.
I tried to run sudo ldconfig... didn't work
As a last ditch effort I tried to manually move the shared object files to the /usr/local/lib directory (to try and perhaps trick the compiler to run the program?) but to no avail.
I tried to run on a new VM and still didn't work
I tried to set LD_LIBRARY_PATH environment variable
The amount of layers I depend on make it impossible to find where the bug is from, there are a lot of separate things going on and it's very multilayered, I don't know where the issue is specifically coming from as it used to work just fine I ran the exact same commands to install CSFML previously, now when I do it it just refuses to run.
The weird thing is when I ran a brand new virtual machine, installed those packages, still same issue.
I am running Linux Mint 21.1, Ubuntu based. Relatively new PC.
I have to make a C (not C++) project to the specifications given by my teacher.
To allow us to test this project he has given us a .pl file that should test the project and a folder full of .in and .out files.
I work on a Win10 machine and has Eclipse for C installed (Kepler).
How can I set up my project to run the provided test?
Do I need to change anything in the test since I don't work on Linux and not from a cmdl?
The program is a train travel planner.
Here is the .pl file:
#!/usr/bin/env perl
use warnings;
use strict;
my ( $createmode ) = #ARGV;
my $testdir = "./tests";
if( defined($createmode) ) {
if($createmode cmp "create") {
print "Brug:\n";
print "\tcheck.pl - tests if your programs output matches .out-filerne\n";
print "\tcheck.pl create - makes new .out-files (deletes the excisting files!)\n";
exit();
}
$createmode=1;
}
# print "$testdir/tests.tst";
open(TESTS, "$testdir/tests.tst");
my $koereplan;
my $startst;
my $slutst;
while (<TESTS>) {
/([\w\d]+)\.in\s+\"(.+)\"\s+\"(.+)\"/ && do {
$koereplan="$testdir/$1";
$startst=$2;
$slutst=$3;
# print $koereplan."\t".$startst."\t".$slutst."\n";
open(RUN, "./travelplanning $koereplan.in '$startst' '$slutst' |");
my $cost=0;
while(<RUN>) {
/^(\d+)\s+(\d+)$/ && do {
$cost=$1+$2*15;
}
};
#print "Cost fra programmet: $cost";
my $outfile="$koereplan.$startst.$slutst.out";
# print $outfile."\n";
if($createmode) {
open(OUT, ">$outfile") or die "Couldn't open '$outfile' for writing";
} else {
open(IN, "<$outfile") or die "Couldn't open '$outfile' for reading";
}
if($createmode) {
print OUT "$cost\n";
} else {
my $facit=<IN>;
if($facit cmp "$cost\n") {
chomp $facit;
print "ERROR: $koereplan.in $startst $slutst gav $cost og facit er $facit.\n";
#last;
} else {
chomp $facit;
print "SUCCES: $koereplan.in $startst $slutst gav $cost og facit er $facit.\n";
};
};
};
}
Some names are in Danish, sorry about that. Koereplan = timetable, slut = end.
Excample of the .in files:
Esbjerg, 07:48
Bramming, 08:00
Vejen, 08:15
Kolding, 08:30
Middelfart, 08:45
Odense, 09:14
Nyborg, 09:29
Korsør, 09:42
Slagelse, 09:53
Sorø, 10:01
Ringsted, 10:10
Roskilde, 10:26
Høje Taastrup, 10:34
Valby, 10:42
København H, 10:48
This is just station names and departure times.
The .out files just contain one number each, the number of minutes the corresponding trip will take.
The scaffold project also came with makefile files, but I haven't been able to use them in my environment, I have simply taken the "business-files" to another project made in Eclipse, and that works fine for compiling and running the project in Eclipse. But that doesn't allow me to use the test script (that I currently can't even open in Eclipse).
If you feel it helps, here is the assignment: assignment on course website
But I think I can solve the assignment itself, it's using the teachers test I'm unsure about how to do.
To start Eclipse CDT choose 1 of these methods:
Start eclipse from the terminal that works, e.g.:
$ /path/to/eclipse.exe &
Make sure msys and mingw's bin directories are in the PATH and start eclipse the "normal" way
Then you can import your project as a new C Project and build/debug/run within CDT as normal:
Choose File menu | New | Makefile Project with Existing Code
Enter path to your project and name. But leave indexer settings as <none>* and press Finish
Open the Make Target view
Right-click on the project and choose New...
Fill in the target you want to build
Double-click on the new green icon and the build will run with the output in the Console view.
Something seems strange in CDT, if I use the obvious setting of MinGW GCC for indexer settings, then I can't do make properly as CDT is insisting on using internal builder.
I am trying to get Rsyslog's imfile plugin working without
any real success.
Here is useful OS version information:
# cat /etc/centos-release
CentOS Linux release 7.1.1503 (Core)
And here is Rsyslog version information:
# rsyslogd -v
rsyslogd 7.4.7, compiled with:
FEATURE_REGEXP: Yes
FEATURE_LARGEFILE: No
GSSAPI Kerberos 5 support: Yes
FEATURE_DEBUG (debug build, slow code): No
32bit Atomic operations supported: Yes
64bit Atomic operations supported: Yes
Runtime Instrumentation (slow code): No
uuid support: Yes
See http://www.rsyslog.com for more information.
I tried both legacy and RainerScript format of the configuration.
None of them works for me, sadly. I must be doing something completely wrong
but I simply can not decide on what it could be.
Here is my actual testing configuration (in RainerScript, the
former legacy version I tested was exactly the same in it's meaning):
# cat /etc/rsyslog.conf
global(
workDirectory = "/tmp"
)
module(
load = "imuxsock"
)
module(
load = "imjournal"
stateFile = "journal.state"
)
module(
load = "imfile"
pollingInterval = "10"
)
ruleset(name = "test-ruleset") {
if $syslogtag contains "test-syslogtag" then {
action(
type = "omfile"
file = "/tmp/test-file.log"
)
stop
}
}
input(
type = "imfile"
tag = "test-syslogtag"
stateFile = "test-input.state"
facility = "daemon"
severity = "debug"
file = "/tmp/test-input.in"
ruleset = "test-ruleset"
)
if prifilt("*.*") then {
action(
type = "omfile"
file = "/tmp/rsyslog-testing.log"
)
}
No warning nor error are produced by the Rsyslog with the above
configuration but also nothing from the /tmp/test-input.in file
is copied to the /tmp/test-file.log.
(I also double-checked the /var/log/audit/audit.log, of course, and ...
nothing suspicious is there. Being desperate on what's going on, I also
tried to setenforce 0 to switch SELinux off completely and to restart
the Rsyslog afterwards. It did not helped so the root cause of the problem
may not be SELinux-related issue.)
Also, the test-input.state file is correctly created in the global
workDirectory path (/tmp in this testing case). I also tried
standard paths (logs in /var/log, state file in /var/lib/rsyslog)
and it does not work either although all related files were created properly.
What's weird: I can not see any change in the state file if I populate the
input log file with some testing data even after Rsyslog restart using
# systemctl restart rsyslog (it should update the state file by default).
Just to point out: the imjournal and imuxsock plugins work and populate the fallback log file /tmp/rsyslog-testing.log correctly. Also
manually running Rsyslog on foreground with -D and/or -d options
did not helped me much to clarify why the imfile plugin does not work
for me in this particular configuration.
So, could you please
check my RainerScript syntax whether there is no obvious fault (I guess there is no such),
show me some working imfile plugin configuration on EL7?
Thank you very much.
--
mjf
With a few minor changes it finaly started to work properly. I think the
main root cause of the problem in my case must have been my testing it in
the /tmp directory where Rsyslog does not seem to work properly for some
reason on CentOS 7.
(May it be the /tmp is populated by the File System Namespace even
despite the fact that Systemd option PrivateTmp is not set to true in
the Rsyslog unit file and this option should be set to false by
default according to the Systemd manual page? This is higly unprobable, but
I haven't managed myself to dig more further into it yet. If I find it out,
I will update this answer.)
The other minor cause might have been incorrect filter written in
RainerScript (my real testing instance contained a horrible typo I
simply over-looked). So here is the resulting testing configuration that
works like charm for me.
# cat /etc/rsyslog.conf
global(
workDirectory = "/var/lib/rsyslog"
)
module(
load = "imuxsock"
)
module(
load = "imjournal"
stateFile = "journal.state"
)
module(
load = "imfile"
pollingInterval = "10"
)
ruleset(name = "test-ruleset") {
if $programname == "test-syslogtag" then {
action(
type = "omfile"
file = "/var/log/test-file.log"
)
stop
}
}
input(
type = "imfile"
tag = "test-syslogtag:"
stateFile = "test-input.state"
facility = "daemon"
severity = "debug"
file = "/var/log/test-input.in"
ruleset = "test-ruleset"
)
if prifilt("*.*") then {
action(
type = "omfile"
file = "/var/log/rsyslog-testing.log"
)
}
A little hint for those not knowing it - the $syslogtag and the
$programname seem to be close relatives: $syslogtag := $programname ":".
You can easily find out all the $ prefixed variables you can match against
by using RSYSLOG_DebugFormat output template which is already compiled in.
I hope it helps.
--
mjf
I am AI student and we work with JavaCC.
I am new with it. I was trying simple example and I had some errors.
1) I downloaded JavaCC 0.6 from it's website
2) I extracted it in disc C
3) I wrote this code in a file with extension ".jj"
PARSE_BEGIN(Test)
import java.io.*;
class Test
{
public static void main(string [] args)
{
new Test(new InputStreamReader(System.in));
start();
}
}
PARSE_END(Test);
Token:
{
<number: (["0"-"9"])+("." (["0"-"9"])+)?(("e"|"E")(["0"-"9"])+)?>|
<plus: "+">
}
void start():
{ }
{
<number>(<plus><number>)*
}
4) I saved it and put it in javacc/bin folder
5) I wrote this line in command
..."my Path"..javacc Test.jj
6) I had this error
Could not find or load main class javacc
Is there something I have to install before these steps?
thx in advance
Use version 5 at https://java.net/projects/javacc/downloads . Version 6.0 is missing the scripts to run JavaCC. If you really want to use version 6.0 you can find the appropriate scripts in version 5, just copy them to version 6's bin directory and away you go.
Update (2020): Since version 6 is now harder to find, I have put a copy at www.engr.mun.ca/~theo/JavaCC/javacc-6.1.0.zip
I selected the step you missed in bold below.
The download should have placed into your file system either a ZIP or
GZIP file containing the JavaCC software. You should go to the directory
where the archive was installed and unzip it's contents. That
completes your installation.
Once you have completed installation, add the bin directory within
the JavaCC installation to your path. The javacc, jjtree, and jjdoc
invocation scripts/executables reside in this directory.
You need to modify PATH system variable in windows (wild guess on used OS).
For example as described in
http://www.computerhope.com/issues/ch000549.htm
http://www.java.com/en/download/help/path.xml
...
I've uploaded my app to google. It has been published. My main exp file was uploaded with app version code 2 and it still bears the same name. My main app is right now at version code 4 and is still using the main.2 exp file.
I've already tested the file with my app through debug.
I've created a test account and i'm signed in on the device with that account and tried downloading 20 minutes after creating that test account.
I believe my file size is correct too. I'm using the the size from the properties 155,630,535 bytes and set it to 155630535L. There is another one called as size on disk which I'm not using.
I've uploaded my apk over 12 hours ago.
Really don't know where I'm going wrong. The only thing I wonder about is my version name which is 1.13. Do I need to use this anywhere?
I'm having problems downloading my expansion files. Initially I was getting 'download failed because you may not have purchased this app'. Now after recompiling (export file) the apk file and uninstalling it and reinstalling it to my device, I've uploaded it to my publish account and now I get 'resources could not be found'. Please help...
ok. I've resolved my issues after a lot of struggling by myself.
First, it's the size of the file in bytes only and not the size of the file in bytes on the disk.
Secondly, they have moved the test account into settings. You need to create a test account.
Thirdly, the app needs to be saved in draft mode. The expansion files will not download while testing using the test account, if the app has been published.
I hope this will help someone.
Some helfull information for people that end up here in this post since there are some things that changed in the way apk expansions work and also if you are using Android Studio to make the libraries work.
NOTE 1
You can't use draft anymore as the link to get the expansion file won't be active yet. You have to upload a version to Alpha or Beta first with expansion file. (adding an expansion file is only possible from the second apk you upload and up) So make sure you see the apk expansion file listed when you click the details in the developer publish section under APK.
NOTE 2
If you are using android studio and want to make use of the downloader library don't just copy the package name and java files into your own app src directory. Import the downloader library in eclipse and choose export => gradle build files. Afterwards you can import the library as a module in android studio.
NOTE 3
Not sure of this but I also think it's neccesary to download the app atleast once through the play store and have access to it with the account on your test device. So if you are working with alpha create a google+ test group and add yourself or other test devices to it.
BTW
With these libraries it's pretty easy to implement the apk expansion download just make sure:
your activity (the one where you want to implement the downloading
of the expansion pack when the downloading has not been done
automatically) implements IDownloaderClient.
you set up the service & receiver and set them up in your manifest.
The BASE64_PUBLIC_KEY in the service class is correct. Upload the
first apk => look in Services and API's in the developer console
under your app => License code for this app.
This code is used to see if the expansion file can be found on the device:
boolean expansionFilesDelivered() {
for (XAPKFile xf : xAPKS) {
String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
Log.i(TAG, "Expansion filename " +fileName);
if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
return false;
}
return true;
}
It uses the class XAPKS wich represents an expansion file, be it either a main or patch file, having a certain filesize(bytes) and associated with a apk version (the one it was first added in).
private static class XAPKFile {
public final boolean mIsMain; // true
public final int mFileVersion; //example 4
public final long mFileSize; //example 126515695L
// example => main expansion that was first introduced in apk version 4 and is 126515695 bytes in size
XAPKFile(boolean isMain, int fileVersion, long fileSize) {
mIsMain = isMain;
mFileVersion = fileVersion;
mFileSize = fileSize;
}
}
Its also quite easy to read movie files and other stuff directly from the expansion file using the zip tools that google has provided (com.android.vending.zipfile).
First get the expansionfile using the methods provided in the library, the paremeters are integers that represent your main expansion apk version (the apk version where the expansion pack you need was first added) and the patch apk version.
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(context, APKX_MAIN_APK, APKX_PATCH_APK);
Video
For playing video directly from this zipresourcefile:
AssetFileDescriptor a = expansionFile.getAssetFileDescriptor(pathToFileInsideZip);
Now from this assetFileDescriptor you can get a FileDescriptor and use this in your mediaplayer, the correct syntax to get your mediaplayer to play the video also needs the second and third parameter.. Be it the startoffset and length you can get from the AssetFileDescriptor.
player.setDataSource(a.getFileDescriptor(), a.getStartOffset(), a.getLength());
Other
For all the other stuff (like images) you can just get an inputstream of the zipresourcefile:
expansionFile.getInputStream(pathToFileInsideZip);`
ALSO make sure you don't compress the videos in the zip for this to work!
for example not to compress .mp4 files:
zip -n .mp4 -r zipfile.zip . -x ".*" -x "*/.*"