rejetto forum

alles im LOG anzeigen

Guest · 9 · 7946

0 Members and 1 Guest are viewing this topic.

c-st

  • Guest
Hallo,

wie bitte kann ich alle Anfragen im HFS LOG anzeigen?

Beispiel:
im HFS liegen die Dateien file01.txt und file02.txt
Wenn jemand auf diese zugreift sehe ich dies im LOG.
Sollte jemand versuchen file03.txt aufzurufen sehe ich dies nicht im LOG.

Danke  :)
"c-st"


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 856
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Hallo, willkommen im Forum. Können sie schreiben einen bildschirmfoto? (Ich verstehe nicht, warum file01.txt und file02.txt auf dem LOG zu sehen ist, und file03.txt nicht).
Prost,
Leo.-


Hi, welcome to the forum. Can you can post a screenshot? (I don't understand why file01.txt and file02.txt can be seen on the LOG, and not file03.txt).
Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


c-st

  • Guest
Hello Leo,
I write better in english?
But my English is not so good.

In HFS server only two files are stored.
  • fiel01.txt
  • file02.txt
When someone clicks on these files, I see it in the LOG.

If someone wants to open a file that is not there
e.g. picture.jpg or sound.mp3
I see the LOG nothing - no error message.

How can I see that?

thank you
c-st


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2061
    • View Profile
it is better for a good understanding between us all, use a text  writing  in a bad English, than use a language that requires the use of a bad translator.

   My native language is French, and I use often an online translator to verify that the English text translated back into French is matching the best what I wanted to say, because the translator often create situations of nonsense


to answer your question, only the downloaded files are logged,
 in the current advancement of programming all other files that are displayed trough mime type in the browser does not have this ability


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 856
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
@c-st:
Yes, it's better to write in english, and not to use a translator.
My native language is Spanish, so my english it's not good, but I understand it well... :)

About this, you can log "the attempt", but not the requested file name.

Follow this steps and check you log:
- Press F6 (this will open your template editor).
- Search for the following text, and add the line marked in red:
(the text in green is not necessary to add, since it's just a test)
Quote
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>
{.add to log|Error 404 Requested file not found.}
<br /><button onclick="alert(document.location.pathname.match(/([^/]*?)?$/)[1])">The missing file is...</button>

- Finally, request a nonexistent file, and check your logs.

That's all I know, since my macro knowledge is limited. Using JavaScript is possible to get the nonexistent requested file name, but I can't find a way to log that.



@Mars: I have a question: Is it possible to combine JavaScript in a Macro, so we can log the nonexistent requested file name in the logs? I've read that using JavaScript is possible to extract the file name, check here, here, here, here, here and here.

I've tried this...
Quote
{.add to log|Error 404 Requested file not found: {:document.location.pathname.match(/([^/]*?)?$/)[1]:}.}
...but it doesn't work. :(

Well, that's all.
Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2061
    • View Profile
The section [not found]  is only invoked when a resource in the  tremplate is called, or when the user uses a direct link to a nonexistent file from his browser. HFS offer never a link to a file that does not exist in a real folder, and no more if the file belongs to VFS and his resource link is broken. the virtual links in VFS still point to a URL, which takes us to the first case considered above.

-----------------------------------------------------------------------------

Regarding your question about if it is possible to combine JavaScript in a Macro,

I would point out that everything use macros is used at the server level (HFS), and everything about the javascript can only be used only on the browser.

Javascript is introduced (used) into the template by using tags: <script> </script>

javascript can be used to perform data formatting which will be sent to the server as some request forms

Usually at the server, we use macros that are executed only under certain conditions of validity using some conditional IF.

we do not always think but it is possible to package JavaScript content by using macros to make a dynamic content of a macro on the browser, such as

{.if |%user|{:<script>  'javascript code visible only when user is connected' </script>:}
      |{:<script>  'if  user is not connected, this javascript is used' </script>:}
.}


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 856
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
Thank you for the info. Yes, I already know Macro runs at server level and JavaScript at user (Browser) level. It would be interesting if we can run some JS without a "if condition", under the section [not found].
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
If someone wants to open a file that is not there
e.g. picture.jpg or sound.mp3
I see the LOG nothing - no error message.
How can I see that?

right click on the Log box
log what
only served requests

disable it!


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 856
  • Status: On hiatus       (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
right click on the Log box
log what
only served requests

disable it!
It works great! And if it's used in conjunction with this:
Quote
[not found]
<h1>{.!Not found.}</h1>
<a href="/">{.!go to root.}</a>
{.add to log|Error 404 Requested file not found.}
...you'll know when someone hit a nonexistent file.
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.